1013基础解法(简短输出)
摘要:题目:求Sn=a+aa+aaa+…+aa…aaa(有n个a)之值,其中a是一个数字,为2。 例如,n=5时=2+22+222+2222+22222,n由键盘输入。解题关键点:1:已知a=2,Sn为所求……
通过递归求解,时间复杂度过高
摘要:解题思路:注意事项:时间复杂度是O(2ⁿ)参考代码:#include<stdio.h>intsum(intn){&nbs……
构造数字并累加C语言
摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ int n; scanf("%d",&n); int a=2; int ……
编写题解 1013: [编程入门]Sn的公式求和
摘要:解题思路:注意事项:参考代码:#include <stdio.h>int main(){ int sum=0; int s=1; int n; int y=0; scanf(&……
慢慢看,慢慢理解,你也能做到,
摘要:解题思路:注意事项:参考代码:#include<stdio.h>int a=0,n=0;int answer=0;int main(){ ……
利用数学函数库和两个for循环解题
摘要:解题思路:注意事项:参考代码:#include<math.h>#include<stdio.h>int main(){ int n,i,j,sum=0……
利用循环得到n次的数字,然后求和
摘要:解题思路:每次循环把上一个值乘10再加上结尾的2注意事项:跳出循环后还需要再算一次和参考代码:int main(){ int a=2,n;&……