1013: [编程入门]Sn的公式求和 观察数的关系 摘要:解题思路:注意事项:222=22*10+2 22=2*10+2参考代码:#include<stdio.h>int main(){ int n,sum = 0,i,a =…… 题解列表 2022年12月24日 0 点赞 0 评论 99 浏览 评分:0.0
循环求和,一种简单的方法实现 摘要:解题思路:若 n = 5,设 变量 a = 0可推:2 = 2 x 1; (a)22 = 2 x 10 + 2 ( a = 2 * 10 + a)222 = 2 x 100 + 22 ( a = 2 …… 题解列表 2023年01月14日 0 点赞 0 评论 102 浏览 评分:0.0
Sn的公式求和 摘要:解题思路:在Sn中,加和项数由n决定,最后一项为‘2’*n,对n+1建立for循环依次得出Sn中每一项,最后加和。参考代码:n = int(input())m = 0for i in range(1,…… 题解列表 2023年01月15日 0 点赞 0 评论 176 浏览 评分:0.0
递归写法,新手尝试,欢迎优化 摘要:#include<stdio.h> #include<math.h> int Fun(int x) { while (x > 0) { return 2 * ((int)pow(1…… 题解列表 2023年02月01日 0 点赞 0 评论 79 浏览 评分:0.0
题解 1013: [编程入门]Sn的公式求和 摘要:参考代码:n = int(input()) i = 1sn = 0while i <= n : sn += int(str(2)*i) i += 1print(sn)…… 题解列表 2023年02月07日 0 点赞 0 评论 134 浏览 评分:0.0
Sn的公式求和 摘要:解题思路:注意事项:参考代码:#pragma warning(disable:4996)//vs2022用来取消scanf的报错#include<stdio.h> int main() { int …… 题解列表 2023年02月11日 0 点赞 0 评论 110 浏览 评分:0.0
注意:两次相加 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ int n; scanf("%d",&n); int sn=0,a=2,aa=0; fo…… 题解列表 2023年03月06日 0 点赞 0 评论 121 浏览 评分:0.0
编写题解 1013: [编程入门]Sn的公式求和 摘要:解题思路:当然是用循环来解决,先把每个数字写出来,存在列表里,再遍历列表把他们加起来参考代码:import math n=int(input()) lis=[] a=0 b=0 for i …… 题解列表 2023年03月29日 0 点赞 0 评论 96 浏览 评分:0.0
Sn公式求和_标题还短吗 摘要:解题思路:注意事项:参考代码:#include<stdio.h>#include <string.h>int main(){ int n =0; int sum = 0; scanf…… 题解列表 2023年03月31日 0 点赞 0 评论 101 浏览 评分:0.0
1013题: Sn的公式求和 摘要:# 自己写的代码 ```c #include int main() { int n,a,sn; scanf("%d",&n); for(int i=0;i…… 题解列表 2023年04月26日 0 点赞 0 评论 160 浏览 评分:0.0