1 条题解

  • 0
    @ 2024-7-11 12:31:45
    #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/=2;
    		}
    		else
    		{
    			cout<<n<<"*3+1="<<n*3+1<<endl;
    			n=n*3+1;
    		}
    	}
    	cout<<"End";
        return 0;
    }
    
    • 1

    信息

    ID
    209
    时间
    1000ms
    内存
    256MiB
    难度
    5
    标签
    递交数
    186
    已通过
    77
    上传者