The 3n + 1 problem(c语言代码) - 解决33%的错误 摘要:注意事项:i,j的输入大小顺序不确定因此要比较i,j并交换i,j要提前打印,如果输入时i>j,交换后,i,j的值就交换了,打印时就出错n = n*3+1可能导致溢出,因此直接将i,j,n全设为long…… 题解列表 2022年10月31日 0 点赞 0 评论 170 浏览 评分:0.0
【如果你也是“答案错误67”】C语言之判断最长周期 摘要::fa-envelope-o:主要需要注意的就是: 要比较输入的i,j的大小,可以先输入大的值后输入小的值 ```c #include long long int T_num(int num…… 题解列表 2022年11月04日 0 点赞 0 评论 138 浏览 评分:0.0
20221124The 3n + 1 problem 摘要:解题思路:注意事项:输入&a,&b不确定其大小参考代码:#include <stdio.h>long len(long n){ long c=1; while(n!=1) { if (n%2==0…… 题解列表 2022年11月24日 0 点赞 0 评论 172 浏览 评分:0.0
1095: The 3n + 1 problem 摘要:解题思路:注意事项:参考代码:#includeint asd(int n){ int a; if (n % 2 == 0) { a = 1; } else { a = 0; } return…… 题解列表 2022年12月23日 0 点赞 0 评论 151 浏览 评分:0.0
我这个应该是挺好理解的吧 摘要:```cpp #include using namespace std; int main() { int n,m; while(cin>>n>>m)//n…… 题解列表 2023年01月19日 0 点赞 0 评论 224 浏览 评分:0.0
LikeWater - 1095: The 3n + 1 problem 摘要:#####这题挺搞心态的,题目样例全是a小于b结果提交测试里面会有a大于b的情况,然后导致出错,要是有执拗的人不想看题解真要被折磨半天,题目应该提示一下,不然很烦。 ```cpp #inclu…… 题解列表 2023年03月22日 0 点赞 0 评论 388 浏览 评分:0.0
题解 1095: The 3n + 1 problem 摘要:解题思路:注意事项:还得先比较输入的两个数的大小!!!参考代码#include<stdio.h> int main() { int a,b,m,n,j,temp; int su…… 题解列表 2023年04月03日 0 点赞 0 评论 113 浏览 评分:0.0
The 3n + 1 problem(乐,别忘了i和j的值要比下大小,再使用,还有如果i如果大于j的话,你交换了他们的值,但最终结果输出i和j必须是输入的i和j) 摘要:解题思路:注意事项:参考代码:#include<stdio.h> int main() { int a,b; while(~scanf("%d%d",&a,&b)) { i…… 题解列表 2023年10月04日 0 点赞 0 评论 114 浏览 评分:0.0
1095: The 3n + 1 problem 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int f(int n){ int i=1; while(n!=1) { if(n%2==0) n=n/2; else …… 题解列表 2023年11月03日 0 点赞 0 评论 155 浏览 评分:0.0
The 3n + 1 problem 摘要:解题思路:利用for循环逐个遍历输入数之间的数,计算每一个数的周期,找到最大周期即可注意事项:本题有一个坑,输入的第一个数不一定是大于第二个数的,所以需要找到输入两数中的较大值与较小值参考代码:#in…… 题解列表 2024年03月08日 0 点赞 0 评论 229 浏览 评分:0.0