Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Author: 曹北健(37509)
- Result: AC Submission_id: 4205679
- Created at: Mon Mar 21 2022 20:32:30 GMT+0800 (China Standard Time)
- Problem: 5422 Time: 18 Memory: 1724
- */
- #include<stdio.h>
- int main()
- {
- int a,b,c,d,e,f,g,h,t1,t2,t3,t4;
- double p;
- scanf("%d:%d %d:%d\n %d:%d %d:%d",&a,&b,&c,&d,&e,&f,&g,&h);
- t1=a*60+b;
- t2=c*60+d;
- t3=e*60+f;
- t4=g*60+h;
- if(t2<=t3)
- {
- printf("G00D!");
- }
- else if(t1>=t4)
- {
- printf("0HN0!");
- }
- else if(t1<=t3&&t3<=t2&&t2<=t4)
- {
- p=1-((1.0*(t2-t3)*(t2-t3))/((t2-t1)*(t4-t3)))/2;
- printf("%.8f",p);
- }
- else if(t3<=t1&&t1<=t2&&t2<=t4)
- {
- p=((1.0*(2*t4-t1-t2)*(t2-t1))/((t2-t1)*(t4-t3)))/2;
- printf("%.8f",p);
- }
- else if(t1<=t3&&t3<=t4&&t4<=t2)
- {
- p=((1.0*(t3+t4-2*t1)*(t4-t3))/((t2-t1)*(t4-t3)))/2;
- printf("%.8f",p);
- }
- else if(t3<=t1&&t1<=t4&&t4<=t2)
- {
- p=((1.0*(t4-t1)*(t4-t1))/((t2-t1)*(t4-t3)))/2;
- printf("%.8f",p);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment