1. 题目只要求输入一个数,你为啥读了俩?
2. `scanf` 不能用成 `%1lf` 或类似的,只需要 `%lf` 就行了。
by ATZdhjeb @ 2023-08-02 18:18:15
我的代码长这样:
```cpp
#include<bits/stdc++.h>
using namespace std;
int main(){
double a;
cin >> a;
double b = 2;
int ans = 0;
double c = 0;
while(c < a){
c+=b;
b *= 0.98;
ans++;
}
cout << ans;
}
```
所以那里输入两个数?第一步游2米,写哪里了?每游一下距离少98%,在哪?
by luogu10086 @ 2023-08-02 18:21:46
@[SYX2022](/user/827723) 题目只读一个数啊
by FrostDi @ 2023-08-02 18:28:44
@[SYX2022](/user/827723)
```cpp
#include<bits/stdc++.h>
using namespace std;
int main(){
double a;
cin>>a;
cout<<ceil(log(1-a/100)/log(0.98));
return 0;
}
```
这代码必过,纯数学。
AC了记得关一下哦
by PVZ__2 @ 2023-08-03 18:50:03
@[PVZ__2](/user/970447) what?
~~康不懂(悲)~~
by SYX2022 @ 2023-08-03 19:31:38