1013: [编程入门]Sn的公式求和 摘要:解题思路:注意事项:参考代码:n=int(input())k=0s=0sum=0while True: m=2*(10**k) s=s+m sum=sum+s if n!=k+…… 题解列表 2024年01月23日 0 点赞 0 评论 166 浏览 评分:0.0
两个嵌套for循环解法 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ int n, b, sum; scanf("%d",&n); sum = 0; for …… 题解列表 2024年02月03日 0 点赞 0 评论 94 浏览 评分:0.0
跟上题解决思路一致,两个嵌套for循环解法 摘要:解题思路:这里主要先分析阶乘求和,主要有两个步骤:第一个步骤是从n递减相乘,再将n-1重新循环再递减相乘,直到n=1;这部分代码如下: for (a = n; a >= 1; a--) { …… 题解列表 2024年02月04日 0 点赞 0 评论 107 浏览 评分:0.0
Sn的公式求和,递归 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int fun(int ret) { if (ret > 9) { return ret + fun(ret / 10); } els…… 题解列表 2024年02月22日 0 点赞 0 评论 136 浏览 评分:0.0
Sn的公式求和(while循环求解) 摘要:解题思路:注意事项:参考代码:#include<iostream>using namespace std;int n;int main(){ cin>>n;//输入n int sum=0;//计算总和…… 题解列表 2024年04月11日 0 点赞 0 评论 160 浏览 评分:0.0
编写题解 1013: [编程入门]Sn的公式求和 摘要:解题思路:注意事项:参考代码:import java.util.*;public class Main { public static void main(String[] args) { …… 题解列表 2024年04月19日 0 点赞 0 评论 552 浏览 评分:0.0
1013: [编程入门]Sn的公式求和 摘要:解题思路:注意事项:参考代码:n = int(input()) s = 0 for i in range(1, n + 1): temp = '2' * i s…… 题解列表 2024年04月29日 0 点赞 0 评论 304 浏览 评分:0.0
简单易懂求Sn的值 摘要:解题思路:Sn=a+aa+aaa+...,可以看成是Sn=A1+A2+A3+....而A1=a*10^0, A2=A1+a*10^1, A3=a*10^2+A2,所以可以得出 An=a*1…… 题解列表 2024年07月17日 0 点赞 0 评论 246 浏览 评分:0.0
编写题解 1013: [编程入门]Sn的公式求和 摘要:解题思路:注意事项:参考代码:#include <stdio.h>#include <stdlib.h>#include <string.h>int everyresult(int n);int ma…… 题解列表 2024年09月06日 0 点赞 0 评论 121 浏览 评分:0.0
循环的方式求和Sn 摘要:解题思路:注意到22=2*10+2;222=22*10+2;因而可用双层for循环。注意事项:int sum 要定义到外层循环内部,保证每次循环时sum的初始值都是2.参考代码:#include<st…… 题解列表 2024年10月05日 0 点赞 0 评论 140 浏览 评分:0.0