题解 1095: The 3n + 1 problem

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

筛选

这道题测试点有问题,草

摘要:解题思路:注意事项:参考代码:#include <iostream>#include <stdio.h>using namespace std;int main() { int a, b; while……

1095 清晰解答

摘要:解题思路:注意事项:就是坑,考虑的细节较多参考代码:while True:    try:        i,j = map(int,input().split())        print(i,j……

1095: The 3n + 1 problem

摘要:解题思路:大致用英语翻译即可。注意事项:注意前面一个输入的值可能比后面的小。参考代码:def my_f(a,b):    flag=0    if a>b:        a,b=b,a       ……

c语言解3n+1问题

摘要:解题思路:    对于3n+1问题得到序列的长度我们可以用一个递归解决。    题目没有说明输入的个数,因此需要流结束符来结束程序。    题目要求算出i和j之间的最大值,因此需要用一个for循环。注……

题目化解+操作数函数+赋初值与输入输出解释

摘要:题目简化:1.对于n ,如果n是偶数,则除以2 ;如果n是奇数,乘以3再加1 。这会产生 从n到1的 操作次数。(如n=1时,操作次数为1 ,即 有1个数) 2.对于 每一对输入的整数i和j , 要……

1095: The 3n + 1 problem

摘要:解题思路:用 while() 每次接收两个数,用 for() 对两个数间所有数进行遍历,并更新最大循环长度。注意事项:测试用例里面有 num1 > num2 的,一开始完全没意识到,卡了很久。参考代码……

The 3n + 1 problem (c++)

摘要:解题思路:真的是又长又臭参考代码:#include<iostream>using namespace std;int main(){    long long count = 1;    long l……

1095: The 3n + 1 problem

摘要:```cpp #include using namespace std; int main() { int m,n,max; while(cin>>m>>n) {……