提交时间:2024-02-10 14:22:25
运行 ID: 40406
#include<iostream> using namespace std; int main() { int a; cin>>a; while(a!=1){ if(a%2==1){ cout<<a<<"*3+1="<<3*a+1; a=3*a+1; } else{ cout<<a<<"/2="<<a/2; a/=2; } cout<<endl; } cout<<"End"; }