大佬求改
查看原帖
大佬求改
1719195
wyz120128楼主2025/6/27 16:12

大佬求改

#include <iostream>
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{cout<<n<<"*3+1="<<n*3+1<<endl;
n=n*3+1;
}
}
cout<<"End";
return 0;
}
2025/6/27 16:12
加载中...