不费脑很直接,但是计算机可能工作量大,适合新手 摘要:```cpp #include int main() { int m,n; int i; scanf("%d%d",&m,&n); for(i=m;m%i!=0||n%i!=0;…… 题解列表 2022年11月28日 0 点赞 0 评论 443 浏览 评分:0.0
1052: [编程入门]链表合并 摘要:解题思路:注意事项:参考代码: #include<stdio.h> #include<stdlib.h> typedef struct student { int…… 题解列表 2022年11月29日 0 点赞 0 评论 349 浏览 评分:0.0
优质题解 3013: 求小数的某一位 摘要:解题思路:这道题的难点是怎么查询小数点后的位数,最简单的做法是将浮点数转换成字符串,查找到小数点后就可以找到小数点n位后的那个值了,c++里的string库里提供了浮点数转字符串的to_string函…… 题解列表 2022年11月29日 0 点赞 0 评论 1237 浏览 评分:9.9
3014: 计算星期几(快速幂) 摘要:解题思路:这道题本质上还是很简单的,对7取余就可以了,一般的for循环取b次,使用快速幂是logb次,数据规模也不是很大,都可以。参考代码:#include <iostream> using n…… 题解列表 2022年11月29日 0 点赞 0 评论 717 浏览 评分:9.9
3015: 幂的末尾(快速幂) 摘要:解题思路:得到末尾三位就是对1000取余,如1234%1000=234,这样就得到了末尾三位。因为b并不是很大,所以用不用快速幂都可以。注意输出格式,不足三位前面补0。参考代码:#include <i…… 题解列表 2022年11月29日 0 点赞 0 评论 650 浏览 评分:9.9
3016: 第几项(n*-~n>>1) 摘要:解题思路:根据求和公式,m=n*(n+1)/2,知道m逆求n,n大概等于根号下(m*2),演算一下,不是就+1。n*(n+1)/2可以写成(n*-~n>>1)>>1是二进制右移,相当于/2~n=-n-…… 题解列表 2022年11月29日 0 点赞 0 评论 438 浏览 评分:9.9
百分制成绩转换(if级联) 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ int n,a[100],x,s=0,i; scanf("%d",&n); for(i=0;i<n;i++) s…… 题解列表 2022年11月29日 0 点赞 0 评论 383 浏览 评分:9.9
一种超简单的方法 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int isprime(int j){ int a; a=1; for(int i=2;i<j;i++) { …… 题解列表 2022年11月29日 0 点赞 0 评论 335 浏览 评分:0.0
2785: 判断一个数能否同时被3和5整除 摘要:解题思路:注意事项:参考代码:import sysa = int(input())if a < -1000000 or a > 1000000: sys.exit() …… 题解列表 2022年11月29日 0 点赞 0 评论 591 浏览 评分:8.0
2786: 判断能否被3、5、7整除 摘要:解题思路:不用循环,只用条件判断语句注意事项:参考代码:a = int(input())if a % 3 == 0 and a % 5 == 0 and a % 7 == 0: print(&#…… 题解列表 2022年11月29日 0 点赞 0 评论 748 浏览 评分:2.0