gaohuashengtx @ 2024-12-22 20:40:56
#include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
for(int i=1;;i++){
if(n%2==0){
cout<<n<<"/2="<<n/2<<endl;
if(n/2==1)break;
n/=2;
}
else{
cout<<n<<"*3+1="<<n*3+1<<endl;
n=n*3+1;
}
}
cout<<"End";
return 0;
}
by ChenHaoQi @ 2024-12-22 20:50:34
@zxckhj114514 正解
by ChenHaoQi @ 2024-12-22 20:51:32
@pika_ 你这个不对吧 End
by gaohuashengtx @ 2024-12-22 20:52:03
@zxckhj114514 谢谢!
by zxckhj114514 @ 2024-12-22 20:52:05
@ChenHaoQi 同意
by gaohuashengtx @ 2024-12-22 20:55:25
@pika_ 只有在是偶数的情况下n才有可能为1 若为奇数会变大 不可能产生1