题解 2815: 求特殊自然数 摘要:解题思路:注意事项:参考代码:def switch_n(n,d): l = [] while n > 0: l.append(str(n % d)) n = n…… 题解列表 2024年07月30日 0 点赞 0 评论 225 浏览 评分:0.0
统计满足条件的4位数个数 摘要:解题思路:注意事项:参考代码:n = int(input())l = list(map(int,input().split()))count = 0for i in l: a = i%10 …… 题解列表 2024年07月30日 0 点赞 0 评论 393 浏览 评分:0.0
2817: 级数求和 摘要:解题思路:注意事项:参考代码:k = int(input())s = 0n = 0while k >= s: n += 1 s += 1/nprint(n)…… 题解列表 2024年07月30日 0 点赞 0 评论 205 浏览 评分:0.0
用数学的解题方式求pi 摘要:解题思路:根据题目给出的 pi/4=1-1/3+1/5-1/7...公式 可以知道分子奇数项为1,偶数项为-1,分母是公差为2的等差数列,所以分子可以写成 -1^(n-1) ,n从1开始,分母可以写成…… 题解列表 2024年07月30日 1 点赞 0 评论 215 浏览 评分:0.0
2818: 分离整数的各个数位 摘要:解题思路:注意事项:参考代码:n = str(input())for i in range(len(n)-1,-1,-1): print(n[i],end=" ")…… 题解列表 2024年07月30日 0 点赞 0 评论 251 浏览 评分:0.0
2819: 数字反转 摘要:解题思路:注意事项:参考代码:n = int(input())if n >= 0: s = str(n)[::-1] print(int(s))else: n = -n s =…… 题解列表 2024年07月30日 0 点赞 0 评论 205 浏览 评分:0.0
2820: 含k个3的数 摘要:解题思路:注意事项:参考代码:a,b = map(int,input().split())c = 0for i in str(a): if i == '3': c …… 题解列表 2024年07月30日 0 点赞 0 评论 193 浏览 评分:0.0
STL句子拆分成单词 摘要:#include<bits/stdc++.h> using namespace std; set<string>s; int main() { string str,c; …… 题解列表 2024年07月30日 0 点赞 0 评论 187 浏览 评分:0.0
c++的compare就是c的strcmp 摘要:#include<bits/stdc++.h> using namespace std; int main() { string s[3]; cin>>s[0]>>s[1]>…… 题解列表 2024年07月30日 0 点赞 0 评论 183 浏览 评分:0.0
1852: 求1+2+3+...+n的值 摘要:解题思路:用for循环,从1累加到n。注意事项:n<=1000000000,变量得开long long。参考代码:#include<bits/stdc++.h>using namespace std;…… 题解列表 2024年07月30日 0 点赞 0 评论 168 浏览 评分:0.0