20分求助!#1AC #4TLE 其余WA

P1423 小玉在游泳

@[xuyufei123](/user/878589) 你把```i++```移到循环内的判断之前。
by ZZYX_18670145320 @ 2024-02-06 12:53:44


@[xuyufei123](/user/878589) 改成``` #include <bits/stdc++.h> using namespace std; int main() { double b=0,cnt=2,s; cin>>s; for(int i=1;;i++){ b+=cnt; if(b>=s){ cout<<i; return 0; } cnt*=0.98; } return 0; } ```
by miffy_123 @ 2024-02-06 13:18:20


``` #include <bits/stdc++.h> using namespace std; int main() { double b=0,cnt=2,s; cin>>s; for(int i=1;;i++){ b+=cnt; if(b>=s){ cout<<i; return 0; } cnt*=0.98; } return 0; } ```
by miffy_123 @ 2024-02-06 13:20:38


过了,谢谢!!!
by xuyufei123 @ 2024-02-07 12:13:34


|