为啥TLE

B2077 角谷猜想

V_HAPPY666 @ 2024-03-09 22:24:57

#include <bits/stdc++.h>
using namespace std;

int main()
{
    ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    //freopen("?.in","r",stdin);
    //freopen("?.out","w",stdout);
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<"End";
        exit(0);
    }
    while(n!=1)
    {
        if(n%2!=0)
        {
            cout<<n<<"*3+1="<<n*3+1<<endl;
            n=n*3+1;
        }
        else
        {
            cout<<n<<"/2="<<n/2<<endl;
            n=n/2;
        }
    }
    cout<<"End";
    return 0;
}

by V_HAPPY666 @ 2024-03-09 22:28:33

改了long long就能过,这是什么题啊


|