TLE求助!!!

P1423 小玉在游泳

@[MacyZhang2011](/user/1130058) 要用 double,不能用int
by zjzx_wcj @ 2024-06-08 20:46:15


@[MacyZhang2011](/user/1130058) # code ```cpp #include<bits/stdc++.h> using namespace std; int main(){ int s = 0; double cnt = 0,cnt1 = 0; int ans = 1; cin >> s; cnt = 2; cnt1 = cnt * 0.98; while(cnt < s){ cnt += cnt1; cnt1 *= 0.98; ans ++; } cout << ans; return 0; } ```
by zjzx_wcj @ 2024-06-08 20:47:06


@[zjzx_wcj](/user/1346614) 谢谢
by MacyZhang @ 2024-06-08 20:51:55


@[zjzx_wcj](/user/1346614) 但是只有80分
by MacyZhang @ 2024-06-08 20:53:20


@[MacyZhang2011](/user/1130058) ans要用int类型的
by WEICY123 @ 2024-06-08 21:16:59


|