【Python】如何一行解决这道题 摘要:解题思路:普通的思路注意事项:没什么注意的参考代码:print(sum(list(map(int, [i*'2' for i in range(1,int(input())+1)]))…… 题解列表 2023年11月12日 1 点赞 4 评论 803 浏览 评分: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 评论 545 浏览 评分:10.0
[编程入门]Sn的公式求和 摘要:解题思路:列举几个数进行观察:2=0*10+2 //易得除了第一项外,其他都是前一项*10+2。因此我们也能得出相应的关系,an=(an-1)*10+2,最后循环即可 …… 题解列表 2024年10月27日 1 点赞 0 评论 532 浏览 评分: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 评论 997 浏览 评分: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 点赞 0 评论 282 浏览 评分:10.0