TLE代码求调
查看原帖
TLE代码求调
755412
DPG_DPG123楼主2023/7/11 12:01

rt,TLE了,评测记录: https://www.luogu.com.cn/record/114858309

# include <iostream>
using namespace std;
int main(){
    int n;
    cin >> n;
    while (n != 1){
        if (n%2==1) {
            cout << n << "*3+1=" << n*3+1 << endl;
            n *= 3, n += 1;
        }else{
            cout << n << "/2=" << n/2 << endl;
            n /= 2;
        }
    }
    cout << "End";
    return 0;
}
2023/7/11 12:01
加载中...