Traffic Light

Easy · rating 950 · Simulation, Math

A light cycles GREEN for g seconds, then YELLOW for y, then RED for r, forever. Read g y r t and print the light's colour at second t (the cycle starts at GREEN at second 0).

Constraints: 1 ≤ g, y, r ≤ 104, 0 ≤ t ≤ 109

Related problems

Open Traffic Light in Code Arena →