60分求救 3AC 2WA

P1426 小鱼会有危险吗

# code: ```cpp #include <bits/stdc++.h> using namespace std; int main(){ double v = 7,f = 0,s,x,a = 0; cin >> s >> x; if(s - x <= 0 && s + x >= v){ cout << 'y'; return 0; } while(a <= s+x){ a += v; v *= 0.98; if(a >= s - x && a <= s + x){ if(a + v <= s + x){ cout << 'y'; return 0; }else if(a + v > s + x){ cout << 'n'; return 0; } } } return 0; } ```
by lihaoyu68 @ 2024-04-23 17:40:21


|