用cin它不香吗?
by YeHaiFengYC2204 @ 2023-08-09 21:46:31
getchar()只识别第一个字符,本人亲测
by YeHaiFengYC2204 @ 2023-08-09 21:47:13
@[YeHaiFengYC2204](/user/561482) cin一样,还是20分
by liu12073_ @ 2023-08-09 21:49:38
啊?我再看看
by YeHaiFengYC2204 @ 2023-08-09 21:50:25
@[liu12073_](/user/997339) 那你可以试试累加而不是累减,累减精度有限制,我就是这么做的
by YeHaiFengYC2204 @ 2023-08-09 21:51:31
我先下线一下
by YeHaiFengYC2204 @ 2023-08-09 21:53:09
@[YeHaiFengYC2204](/user/561482) 谢谢你一直耐心答复,我去试试
by liu12073_ @ 2023-08-09 21:53:20
@[YeHaiFengYC2204](/user/561482) 解决了
by liu12073_ @ 2023-08-09 22:25:33
@[liu12073_](/user/997339) 考古
by sfqxx1 @ 2023-08-10 13:00:26
@[liu12073_](/user/997339)
```cpp
#include <iostream>
using namespace std;
int main()
{
long double a=2, sum=0, step=0, target;
cin >> target;
while(sum < target)
{
sum += a;
a = a/100*98;
step++;
}
cout << step;
return 0;
}
``````
by z_perfect @ 2023-08-15 15:26:47