```cpp
#include<bits/stdc++.h>
using namespace std;
float a,q,h=2;
int s;
int main(){
cin>>a;
while (s<a){
q=q+h;
h=h*0.98;
s++;
}
cout<<s;
return 0;
}
```
by yangzhanshuo @ 2023-11-12 22:19:19
666
by jzr200143 @ 2023-11-17 20:52:36
@[great_mad](/user/1160345) 应该是s>=k吧,我把我的代码粘在下面```c
#include<stdio.h>
int main()
{
double s = 0;
scanf("%lf", &s);
double v = 2, a = 0.98, S = 0;
int n = 0;
while (S <= s)
{
S = S + v;
v = v * a;
n++;
}
printf("%d\n", n);
return 0;
}
```
by Kelly_1 @ 2023-12-22 20:34:06