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
- Apply a Discount — Easy
- Discounted Price — Easy
- Leap Year — Easy
- Plus One — Easy
- Product of Digits — Easy
- Snake Length — Easy