提交时间:2024-12-26 17:16:13

运行 ID: 59507

#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; while(n!=1){ if(n%2==1){ cout<<n<<"*3+1="<<n*3+1<<endl; n=n*3+1; } if(n%2==0){ cout<<n<<"/2="<<n/2<<endl; n=n/2; } } cout<<"End"<<endl; return 0; }