5 条题解

  • 0
    @ 2025-2-4 11:05:05
    #include<bits/stdc++.h>
    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"<<endl;
    	return 0;
    }
    

    信息

    ID
    77
    时间
    1000ms
    内存
    128MiB
    难度
    5
    标签
    (无)
    递交数
    117
    已通过
    47
    上传者