题解 1095: The 3n + 1 problem

来看看其他人写的题解吧!要先自己动手做才会有提高哦! 
返回题目 | 我来写题解

筛选

The 3n + 1 problem (C++代码) principle's simple c++

摘要:解题思路:注意事项:此题有两个坑点:第一,并没有说i一定小于j第二,在输入后就应该立刻输出,否则对ij处理完之后就会出错。当然,用户体验用脚趾头想一下都知道非常糟糕。参考代码:#include <io……

The 3n + 1 problem,goto真好用!

摘要:解题思路:注意事项:参考代码:#include"bits/stdc++.h" using namespace std; int main(){     // 定义变量a, b, c和数组d,l用……

The 3n + 1 problem

摘要:解题思路:利用for循环逐个遍历输入数之间的数,计算每一个数的周期,找到最大周期即可注意事项:本题有一个坑,输入的第一个数不一定是大于第二个数的,所以需要找到输入两数中的较大值与较小值参考代码:#in……

LikeWater - 1095: The 3n + 1 problem

摘要:#####这题挺搞心态的,题目样例全是a小于b结果提交测试里面会有a大于b的情况,然后导致出错,要是有执拗的人不想看题解真要被折磨半天,题目应该提示一下,不然很烦。 ```cpp #inclu……

The 3n+1 problem

摘要:解题思路:注意事项:参考代码:#include <iostream>#include <algorithm>using namespace std;long long len(long long n)……

1095: The 3n + 1 problem

摘要:从 a 到 b 挨个判断跌落到 1 需要的次数,保存最大的次数。注意 a 大于 b 的情形。#include <bits/stdc++.h> using namespace std; int ……

筛法(赌他不卡我数据

摘要:解题思路:注意事项:参考代码#include <bits/stdc++.h>using namespace std;int a[1001000];int fuck(int x) { int ans =……

思路清晰的解答

摘要:解题思路:按照从大到小或者从小到大的顺序遍历从m到n的所有值(m和n是输入的)。设定temp记录不同值对应len。设定max记录m和n之间(包括i和j)的整数的最大循环长度,每次得到len后与max比……