提交时间:2024-01-26 14:26:17

运行 ID: 128957

#include<iostream> using namespace std; int main(){ int m; cin>>m; cout<<m<<" " ; while(m>1){ if(m%2==0){ m=m/2; cout<<m<<" "; } else{ m=m*3+1; cout<<m<<" ";} } }