我来!
2025-07-22 20:44:57
发布于:江苏
6阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
while(n!=1){
if(n%2==0){
cout<<n<<"/2="<<n/2<<endl;
n/=2;
}
else{
cout<<n<<"*3+1="<<n*3+1<<endl;
n=n*3+1;
}
if(n==1){
cout<<"End";
}
}
return 0;
}
这里空空如也
有帮助,赞一个