5 条题解

  • 1
    @ 2025-11-23 8:45:46
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int n,p=0;
    	cin>>n;
    	while(n!=1)
    	{
    		if(n%2==0)
    		{
    			n/=2;
    		}
    		else
    		{
    			n=n*3+1;
    		}
    		p++;
    	}
    	cout<<p;
    	return 0;
    } 
    
    

    信息

    ID
    2747
    时间
    1000ms
    内存
    256MiB
    难度
    1
    标签
    (无)
    递交数
    48
    已通过
    140
    上传者