题解 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
LikeWater - 1095: The 3n + 1 problem 摘要:#####这题挺搞心态的,题目样例全是a小于b结果提交测试里面会有a大于b的情况,然后导致出错,要是有执拗的人不想看题解真要被折磨半天,题目应该提示一下,不然很烦。 ```cpp #inclu…… 题解列表 2023年03月22日 0 点赞 0 评论 388 浏览 评分: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
The 3n + 1 problem(水题) 摘要:```c #include int fun(int n){ int cnt=0; do{ if(n%2==0){ n/=2; cnt++; } else…… 题解列表 2023年01月12日 0 点赞 0 评论 207 浏览 评分:9.9
1095: The 3n + 1 problem 摘要:```cpp #include #include using namespace std; int fun(int num) { int count=1; while(n…… 题解列表 2023年01月12日 0 点赞 0 评论 204 浏览 评分:9.9
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
耗时18ms,好像有点高了,复杂度更达到了O(n^2).能不能更简单一点 摘要:解题思路:注意事项:参考代码:#include<bits/stdc++.h>using namespace std;int num1(int n,int m){ if(n>m) swap(n,m…… 题解列表 2022年12月10日 0 点赞 1 评论 128 浏览 评分:9.9
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
【如果你也是“答案错误67”】C语言之判断最长周期 摘要::fa-envelope-o:主要需要注意的就是: 要比较输入的i,j的大小,可以先输入大的值后输入小的值 ```c #include long long int T_num(int num…… 题解列表 2022年11月04日 0 点赞 0 评论 138 浏览 评分:0.0
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