DPG_DPG123 @ 2023-07-11 12:01:08
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;
}
by Misophiliac @ 2023-07-11 12:08:12
@DPG_DPG123
int n
-> long long n
by Gohldg @ 2023-07-11 12:55:29
改成int范围不够大,用long long
by lmz105 @ 2023-07-11 16:53:32
@DPG_DPG123 cout << endl;
可以换成cout << "\n";
。还有int
要换成long long
by DPG_DPG123 @ 2023-07-12 10:37:50
@yuanxiuan thx