#include using namespace std; int main(){ int n; cin >> n; while(n!=1){ if(n%2==1){ cout << n <<"3+1=" << n3+1 << endl; n = n*3+1; }else{ cout << n << "/2=" << n/2 << endl; n /= 2; } } cout << "End"; return 0; }
注册一个 XSM 通用账户,您就可以在我们提供的所有在线评测服务上提交代码、参与讨论。
使用您的 XSM 通用账户