on this problem?
In my code, I assumed the times are
real numbers because I got a lot of
WA's assuming they were ints.

Thanks for any help.
Broderick
[c]
#include <stdio.h>
#include <math.h>
typedef struct {
double loc;
double g,y,r;
} light_t;
int n;
light_t light[6];
int checkspeed(int s) {
int i,t;
double v = (double)s / 3600;
for (i=0; i<n; i++) {
t = light.loc/v;
t = fmod(t, light.g + light.y + light.r);
if (t > light.g + light.y + 1e-7) return 0;
}
return 1;
}
int main () {
int i,j,ngood,good[71],cnum=1;
while (scanf("%d ", &n)==1 && n!=-1) {
memset(good, 0, sizeof(good));
for (i=0; i<n; i++)
scanf("%lf %lf %lf %lf ",&light.loc, &light.g, &light.y, &light.r);
for (i=30,ngood=0; i<=60; i++) {
if (checkspeed(i)) {
ngood++;
good[i] = 1;
}
}
printf("Case %d: ", cnum++);
if (!ngood) printf("No acceptable speeds.");
else {
for (i=30; !good[i]; i++) ;
if (!good[i+1]) {
printf("%d",i);
i++;
}
else {
for (j=i+1;good[j]; j++) ;
printf("%d-%d", i,j-1);
i=j;
}
for (; i<=60; ) {
while (!good[i] && i<=60) i++;
if (i>60) break;
for (j=i,i++; good[i] && i<=60; i++) ;
if (j==i+1) printf(", %d", j);
else printf(", %d-%d", j,i-1);
}
}
printf("\n");
}
return 0;
}
[/c]