package com.codegym.task.task04.task0416; /* at the beginning of each hour, the green signal is on for three minutes, then the signal is yellow for one minute, and then it is red for one minute. Then the light is green again for three minutes, etc. Use the keyboard to enter a real number t that represents the number of minutes that have elapsed since the beginning of the hour. Determine what color the traffic light is at the specified time. Display the result as follows: "green" if the light is green, "yellow" if the light is yellow, and "red" if the light is red. */ import java.io.*; public class Solution { public static void main(String[] args) throws Exception { InputStream inputStream=System.in; InputStreamReader inputStreamReader=new InputStreamReader(inputStream); BufferedReader reader = new BufferedReader(inputStreamReader); Double t=Double.parseDouble(reader.readLine()); String color="green"; while(t>0) { t=t-3; color="green"; System.out.println(t + color); if(t>0) {System.out.println(t + color); color="yellow"; t--; System.out.println(t + color); } if(t>0) { System.out.println(t + color); color="red"; t--; System.out.println(t + color); } System.out.println(t + color); } System.out.println(color); } }