https://www.luogu.org/problemnew/show/P1426
题目说的是小鱼进入探测器一秒后就会有危险,所以不应该让小鱼先游,而是先检测探测器。
#include<bits/stdc++.h> using namespace std; #define ll long longint s,x;int main(){scanf("%d%d",&s,&x);double l=s-x;//cout<<l<<endl;double r=s+x;double cur=0;double dx=7.0;int maxt=5000;while(maxt--){if(cur>=l-1e-8)break;cur+=dx;dx*=0.98;}cur+=dx;dx*=0.98;if(cur>=r+1e-8)printf("n\n");elseprintf("y\n"); }