提交时间:2024-11-08 15:45:56
运行 ID: 55813
#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=n/2; } else if(n%2==1){ cout<<n<<"*3+1="<<3*n+1<<endl; n=3*n+1; } } cout<<"End"; return 0; }