|
|
вернуться в форумHELP! What's wrong with my code? #include <stdio.h> #include <math.h> double t11, t12, t21, t22; double h11, h12, h21, h22; double t1, t2, lb, rb, t, h; int main () { scanf ("%lf%lf", &t11, &t12); scanf ("%lf%lf", &t21, &t22); h11 = floor (t11); h12 = floor (t12); h21 = floor (t21); h22 = floor (t22); if ((h11 > 17) && (h12 < 7)) { h12 += 24; t12 += 24; } if ((h21 > 17) && (h22 < 7)) { h22 += 24; t22 += 24; } t1 = (h12 - h11) + (t12 - h12 - t11 + h11) / 60; t2 = (h22 - h21) + (t22 - h22 - t21 + h21) / 60; t = (t1 - t2) / 2; lb = t - 1. / 12 + 1e-20; rb = t + 1. / 12 - 1e-20; printf ("%.0lf\n", fabs (ceil(lb))); return 0; } |
|
|