100分但后两个点TLE

B2077 角谷猜想

bjqxszx_zhongqide @ 2024-07-05 14:43:33

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,j;
    cin>>n;
    while(1){
        if(n%2==1){
            if(n==1){
                cout<<"End";
                return 0;
            }
            j=n;
            n=n*3+1;
            cout<<j<<"*3+1="<<n<<endl;
        }else{
            j=n;
            n/=2;
            cout<<j<<"/2="<<n<<endl;
        }
    }
    return 0;
}

by Grammar__hbw @ 2024-07-05 14:49:00

@bjqxszx_zhongqide 不开long long见祖宗


by Miss_SGT @ 2024-07-05 14:49:10

开longlong


by 鳶一折纸 @ 2024-07-05 14:54:36

@bjqxszx_zhongqide


by 鳶一折纸 @ 2024-07-05 14:55:26

中间结果可能会爆 int


by bjqxszx_zhongqide @ 2024-07-06 10:22:46

谢谢


by yangyichenSB @ 2024-08-07 21:55:07

开long long


|