提交时间:2024-11-09 14:30:46
运行 ID: 56136
#include<bits/stdc++.h> using namespace std; int main(){ int a; cin>>a; while(a!=1){ if(a%2==0){ cout<<a<<"/2="<<a/2<<endl; a/=2; } else if(a%2==1){ cout<<a<<"*3+1="<<3*a+1<<endl; a=3*a+1; } } cout<<"End"; return 0; }