1013: [编程入门]Sn的公式求和 摘要:#include<stdio.h> int main() { int n; scanf("%d",&n); int sum=0; for(int i=1;i<=n;i++){ in…… 题解列表 2022年06月06日 0 点赞 0 评论 144 浏览 评分:0.0
编写题解 1013: [编程入门]Sn的公式求和 摘要:解题思路:注意事项:参考代码:a=int(input())sn=s=0i=1while i<=a: s=s+2*(10**(i-1)) sn=sn+s i+=1print(sn)…… 题解列表 2022年06月15日 0 点赞 0 评论 371 浏览 评分:0.0
Sn的公式求和,1013 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ int num=1,n,total=2,a=2; scanf("%d",&n); while(…… 题解列表 2022年06月21日 0 点赞 0 评论 214 浏览 评分:0.0
[编程入门]Sn的公式求和,C语言递归解法 摘要:解题思路:主要是如何方便的生成222222,这样的数字,可以通过递归的方式,观察得到f(n)=f(n-1)*10+2,所以用递归写还是比较方便的。参考代码:#include<stdio.h> int…… 题解列表 2022年06月22日 0 点赞 0 评论 141 浏览 评分:0.0
题解 1013: [编程入门]Sn的公式求和(C语言-pow函数) 摘要:解题思路:1.判断n是否符合要求2.num变量更新要被求和的数据3.Sn对num进行求和4.正确输出注意事项:用到了求次幂的函数pow(),需要注意添加math头文件。参考代码:#include<st…… 题解列表 2022年07月24日 0 点赞 0 评论 380 浏览 评分:0.0
大家注意坑爹审题 摘要:解题思路:一次for循环轻松解决。注意事项:注意题目要求参考代码:#include<stdio.h>int main(){ int n,i,a=0,Sn=0; scanf("%d",&n); for(…… 题解列表 2022年08月18日 0 点赞 0 评论 397 浏览 评分:0.0
Sn的公式求和 摘要: #include using namespace std; int main() { int n, a=2 , t,sum=0; cin …… 题解列表 2022年10月10日 0 点赞 0 评论 183 浏览 评分:0.0
Sn的公式求和 摘要:解题思路: 循环+pow函数因为每个数的每一位上都是2,故联想到for循环取出每一个数将每一个数存在a中,利用for循环相加注意事项:参考代码:# include <stdio.h># includ…… 题解列表 2022年10月11日 0 点赞 0 评论 195 浏览 评分:0.0
题目 1013: [编程入门]Sn的公式求和—常规求解方法 摘要:解题思路:比如n为4时,则Sn为2*10^0*4+2*10^1*3+2*10^2*2+2*10^3*1注意事项:指数用pow函数参考代码:#include<stdio.h> #include<mat…… 题解列表 2022年10月20日 0 点赞 0 评论 162 浏览 评分:0.0
规律拆分求解 摘要:解题思路: 规律拆分: 2,22 = 2*10 + 2 ,222= 22 * 10 + 2, 2222 = 222 * 10 + 2.。。。以此类推。注意事项: …… 题解列表 2022年10月22日 0 点赞 0 评论 123 浏览 评分:0.0