#include<stdio.h> #include<string.h> #include<stdlib.h> #include<math.h> #include<stdbool.h> typedef struct{ char name[20]; int flag; }Children; int main(){ int n; scanf("%d",&n); int flag; double f0,f1; int time; long c=299792458; int away=0; int count=0; int k=0; while(n--){ scanf("%d %lf %lf %d",&flag,&f0,&f1,&time); k++; double v=(f1-f0)*c/(f1+f0); //printf("--\\%lf---\n",v); if(flag==1){ printf("Target%d:NO:ONE OF US\n",k); }else{ if(v<0){ printf("Target%d:NO:AWAY\n",k); }else{ double dis=c*(time/2e6); //printf("|||%lf|||\n",dis); if(dis>200000){ double distance=dis-200000; double t=distance/v; printf("Target%d:NO:%.4lf\n",k,t); }else{ count++; if(count<=3){ printf("Target%d:YES\n",k); }else{ printf("Target%d:NO:NEXT TIME\n",k); } } } } } } |
Double click to view unformatted code.