题解 1013: [编程入门]Sn的公式求和

来看看其他人写的题解吧!要先自己动手做才会有提高哦! 
返回题目 | 我来写题解

筛选

Sn的公式求和,1013

摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){    int num=1,n,total=2,a=2;    scanf("%d",&n);    while(……

[编程入门]Sn的公式求和,C语言递归解法

摘要:解题思路:主要是如何方便的生成222222,这样的数字,可以通过递归的方式,观察得到f(n)=f(n-1)*10+2,所以用递归写还是比较方便的。参考代码:#include<stdio.h> int……

大家注意坑爹审题

摘要:解题思路:一次for循环轻松解决。注意事项:注意题目要求参考代码:#include<stdio.h>int main(){ int n,i,a=0,Sn=0; scanf("%d",&n); for(……

Sn的公式求和

摘要: #include using namespace std; int main() { int n, a=2 , t,sum=0; cin ……

Sn的公式求和

摘要:解题思路:  循环+pow函数因为每个数的每一位上都是2,故联想到for循环取出每一个数将每一个数存在a中,利用for循环相加注意事项:参考代码:# include <stdio.h># includ……

规律拆分求解

摘要:解题思路:       规律拆分:            2,22 = 2*10 + 2 ,222= 22 * 10 + 2, 2222 = 222 * 10 + 2.。。。以此类推。注意事项:   ……

简单的fot循环语句即可

摘要:解题思路:注意事项:参考代码:# include <stdio.h>int main(void){ int a,n,i; int Sn; scanf("%d", &n); a = 0; Sn = 0;……