提交时间:2026-04-25 21:12:54
运行 ID: 438041
#include <iostream> using namespace std; int hsg(int n) { if (n==1){ return 0; } if (n%2==0){ return 1+hsg(n/2); } else{ return 1+hsg(3*n+1); } } int main(){ int n; cin>>n; cout<<hsg(n)<<endl; return 0; }