#include #define REP(i,n) for(int i=0,i##_len=int(n);i>t>>s>>d; double t_end = t + d/s; double res = 0.0; cerr << t_end << endl; #if 0 while(t_end > 24) { // t を24時まで進める res += max(24.0 - max(t, 18.0), 0.0) + max(0.0, 6.0 - max(t, 0.0)); t_end -= 24; t = 0; } res += max(t_end - max(t, 18.0), 0.0) + max(0.0, min(6.0, t_end) - max(t, 0.0)); #endif printf("%.9f", t_end - t); }