for循环,数组的运用。 摘要:解题思路:注意事项:参考代码:#include<iostream>using namespace std;int main(){ int m; cin>>m; int Sn=0; int a[100]…… 题解列表 2024年10月24日 1 点赞 0 评论 487 浏览 评分:9.9
C语言求解Sn的公式求和 摘要:参考代码:#include <stdio.h> int main() { int n; int a = 2; // a 的值 long long sum = 0;…… 题解列表 2024年11月02日 1 点赞 0 评论 600 浏览 评分:9.9
直接写就行了 摘要:解题思路:注意事项:参考代码:#include<stdio.h> #include<math.h> int main() { int i,j=0,n,Sn=0; scanf…… 题解列表 2024年11月11日 2 点赞 1 评论 949 浏览 评分:9.9
优质题解 [编程入门]Sn的公式求和(C语言) 比较特别的解法 摘要:**解题思路:** 乍一看!这题目这么“2”?我就想,这么工整的数列,要是有个函数可以把字符串转换为整型的,那就好咯!于是我便百度一下,发现真有这个在stdlib.h下的atoi函数。 对,有…… 题解列表 2020年02月14日 4 点赞 2 评论 2967 浏览 评分:10.0
【Python】如何一行解决这道题 摘要:解题思路:普通的思路注意事项:没什么注意的参考代码:print(sum(list(map(int, [i*'2' for i in range(1,int(input())+1)]))…… 题解列表 2023年11月12日 1 点赞 4 评论 998 浏览 评分:10.0
1013: [编程入门]Sn的公式求和 摘要:解题思路:注意事项:参考代码:n = int(input()) s = 0 for i in range(1, n + 1): temp = '2' * i s…… 题解列表 2024年04月29日 1 点赞 0 评论 741 浏览 评分:10.0
[编程入门]Sn的公式求和 摘要:解题思路:列举几个数进行观察:2=0*10+2 //易得除了第一项外,其他都是前一项*10+2。因此我们也能得出相应的关系,an=(an-1)*10+2,最后循环即可 …… 题解列表 2024年10月27日 1 点赞 0 评论 767 浏览 评分:10.0
利用递归求解 摘要:解题思路:n=0,S0=0n=1,S1=2*1n=2,S2=2*1+2*11n=3,S3=2*1+2*11+2*111n=4,S4=2*1+2*11+2*111+2*1111n=n,Sn=2*1+2*…… 题解列表 2025年04月06日 3 点赞 0 评论 1230 浏览 评分:10.0
编写题解 1013: [编程入门]Sn的公式求和 摘要:解题思路:注意事项:参考代码:#include <stdio.h>int main(){ int sum=0; int s=1; int n; int y=0; scanf(&…… 题解列表 2025年11月22日 1 点赞 1 评论 649 浏览 评分:10.0