提交时间:2023-12-10 01:09:41
运行 ID: 33517
#include<iostream> using namespace std; int main(){ int n,s=0; cin>>n; if(n==1){ cout<<"End";return 0; } do{ if(n%2!=0){ cout<<n<<"*3+1="<<n*3+1<<endl; n=n*3+1; } else{ cout<<n<<"/2="<<n/2<<endl; n=n/2; } }while(n!=1); cout<<"End"; return 0; }