Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Author: 曹北健(37509)
- Result: AC Submission_id: 4202181
- Created at: Sun Mar 20 2022 21:04:09 GMT+0800 (China Standard Time)
- Problem: 5422 Time: 3 Memory: 1716
- */
- #include <stdio.h>
- int main()
- {
- int h1, h2, h3, h4, m1, m2, m3, m4;
- int t1, t2, t3, t4;
- double r;
- scanf("%d:%d %d:%d\n", &h1, &m1, &h2, &m2);
- scanf("%d:%d %d:%d", &h3, &m3, &h4, &m4);
- t1 = h1*60 + m1;
- t2 = h2*60 + m2;
- t3 = h3*60 + m3;
- t4 = h4*60 + m4;
- if(t2 <= t3) {
- printf("G00D!\n");
- }
- else {
- if(t1 >= t4) {
- printf("0HN0!\n");
- }
- else {
- int a = 2*(t2 - t1) *(t4 - t3);
- if(t1 <= t3&&t2 <= t4) {
- r = - 1.0* (t2 - t3) *(t2 - t3) /a + 1.0;
- printf("%.8lf\n", r);
- }
- if(t3 < t1&&t2 <= t4) {
- r = 1.0*(2*t4 - t1 - t2) *(t2 - t1) /a;
- printf("%.8lf\n", r);
- }
- if(t1 <= t3&&t4 < t2) {
- r = 1.0*(t3 + t4 - 2*t1) *(t4 - t3) /a;
- printf("%.8lf\n", r);
- }
- if(t3 < t1&&t4 < t2) {
- r = 1.0*(t4 - t1) *(t4 - t1) /a;
- printf("%.8lf\n", r);
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment