Created
May 11, 2013 22:41
-
-
Save anakryiko/5561673 to your computer and use it in GitHub Desktop.
Russian Code Cup 2013 Qualification 2, problem C
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#define FOR(i,f,n) for(int i=f; i<n; ++i) | |
int N, M, K, L, S, V; | |
int main() | |
{ | |
//freopen("in.txt", "r", stdin); | |
//freopen("out.txt", "w", stdout); | |
while (true) | |
{ | |
scanf("%d%d%d%d", &N, &L, &S, &V); | |
if (N == 0) | |
break; | |
double res = S / (0.0 + V); | |
int len = 0; | |
FOR(i,0,N) | |
{ | |
int x, l, v; | |
scanf("%d%d%d", &x, &l, &v); | |
len += L + l; | |
double r = (S + len - x) / (v + 0.0); | |
res = max(res, r); | |
} | |
printf("%.9lf\n", res); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment