用数学的解题方式求pi 摘要:解题思路:根据题目给出的 pi/4=1-1/3+1/5-1/7...公式 可以知道分子奇数项为1,偶数项为-1,分母是公差为2的等差数列,所以分子可以写成 -1^(n-1) ,n从1开始,分母可以写成…… 题解列表 2024年07月30日 1 点赞 0 评论 217 浏览 评分:0.0
2818: 分离整数的各个数位 摘要:解题思路:注意事项:参考代码:n = str(input())for i in range(len(n)-1,-1,-1): print(n[i],end=" ")…… 题解列表 2024年07月30日 0 点赞 0 评论 255 浏览 评分: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 评论 206 浏览 评分: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 评论 195 浏览 评分:0.0
STL句子拆分成单词 摘要:#include<bits/stdc++.h> using namespace std; set<string>s; int main() { string str,c; …… 题解列表 2024年07月30日 0 点赞 0 评论 189 浏览 评分: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 评论 184 浏览 评分: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 评论 169 浏览 评分:0.0
1131: C语言训练-斐波纳契数列 摘要:```cpp #include using namespace std; int a[40]; int fbnq(int n){ a[0]=1,a[1]=1; for(int i=2;…… 题解列表 2024年07月30日 1 点赞 0 评论 199 浏览 评分:0.0
题解 2821: 开关灯 摘要:解题思路:注意事项:参考代码:n,m=map(int,input().strip().split())l = [0 for i in range(n)]for i in range(2,m+1,1):…… 题解列表 2024年07月30日 0 点赞 0 评论 277 浏览 评分:0.0
1119: C语言训练-"水仙花数"问题1 摘要:```cpp #include using namespace std; int a,b,c; int sxh(int n) { a=n/100; b=n/10%10; c=n%…… 题解列表 2024年07月30日 0 点赞 0 评论 227 浏览 评分:0.0