超时了!

B2077 角谷猜想

Whl0924 @ 2024-01-28 16:21:14

#include<bits/stdc++.h>
using namespace std;
int n=0;
int main(){
cin>>n;
    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 Whl0924 @ 2024-01-28 16:22:16

无语死了!!!


by 2333_qwq @ 2024-01-28 16:27:44

@Whl0924 你抄的第一篇题解吧()


by Special_Tony @ 2024-01-28 16:29:40

@Whl0924 洛谷TLE就是想告诉你莂抄题解


by Special_Tony @ 2024-01-28 16:31:01

@Whl0924 另外endl超慢,除了交互题打死不用


by Whl0924 @ 2024-01-28 16:35:21

两个超时。


by chht_0219 @ 2024-01-28 16:35:51

要开longlong


by Whl0924 @ 2024-01-28 16:36:59


|