@[2024yejinghong](/user/1063792)
首先,输入的s是小数,应该用double
by One_JuRuo @ 2023-09-23 09:17:40
其次,你写的好像很麻烦,直接模拟即可,可以参考:
```cpp
#include<bits/stdc++.h>
using namespace std;
int main()
{
int ans=0;
double s,y=2;
cin>>s;
while(s>0)
{
s-=y;
y*=0.98;
++ans;
}
cout<<ans;
return 0;
}
```
by One_JuRuo @ 2023-09-23 09:18:49