wojiaocbj

time

Mar 22nd, 2022
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.92 KB | None | 0 0
  1. /*
  2.  Author: 曹北健(37509)
  3.  Result: AC Submission_id: 4205679
  4.  Created at: Mon Mar 21 2022 20:32:30 GMT+0800 (China Standard Time)
  5.  Problem: 5422  Time: 18    Memory: 1724
  6. */
  7.  
  8. #include<stdio.h>
  9. int main()
  10. {
  11.  int a,b,c,d,e,f,g,h,t1,t2,t3,t4;
  12.  double p;
  13.  scanf("%d:%d %d:%d\n %d:%d %d:%d",&a,&b,&c,&d,&e,&f,&g,&h);
  14.  t1=a*60+b;
  15.  t2=c*60+d;
  16.  t3=e*60+f;
  17.  t4=g*60+h;
  18.  if(t2<=t3)
  19.  {
  20.   printf("G00D!");
  21.   }
  22.  else if(t1>=t4)
  23.  {
  24.     printf("0HN0!");
  25.  }
  26.  else if(t1<=t3&&t3<=t2&&t2<=t4)
  27.  {
  28.   p=1-((1.0*(t2-t3)*(t2-t3))/((t2-t1)*(t4-t3)))/2;
  29.   printf("%.8f",p);
  30.  }
  31.  else if(t3<=t1&&t1<=t2&&t2<=t4)
  32.  {
  33.   p=((1.0*(2*t4-t1-t2)*(t2-t1))/((t2-t1)*(t4-t3)))/2;
  34.   printf("%.8f",p);
  35.  }
  36.  else if(t1<=t3&&t3<=t4&&t4<=t2)
  37.  {
  38.   p=((1.0*(t3+t4-2*t1)*(t4-t3))/((t2-t1)*(t4-t3)))/2;
  39.   printf("%.8f",p);
  40.  }
  41.  else if(t3<=t1&&t1<=t4&&t4<=t2)
  42.  {
  43.   p=((1.0*(t4-t1)*(t4-t1))/((t2-t1)*(t4-t3)))/2;
  44.   printf("%.8f",p);
  45.  }
  46.  return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment