(URI) Domingo de Manhã - Solução
import java.io.*;
class Main {
public static void printAnswer(int terminal, int maxTime) {
if (terminal-maxTime <= 0) {
System.out.println("Atraso maximo: 0");
}
else {
System.out.println("Atraso maximo: " + (terminal-maxTime));
}
}
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
// 8h*60 = 480min
int maxTime = 480;
String time;
while ((time = br.readLine()) != null) {
String[] hour = time.split(":");
int terminal = Integer.parseInt(hour[0])*60 + Integer.parseInt(hour[1]) + 60;
printAnswer(terminal, maxTime);
}
}
}
class Main {
public static void printAnswer(int terminal, int maxTime) {
if (terminal-maxTime <= 0) {
System.out.println("Atraso maximo: 0");
}
else {
System.out.println("Atraso maximo: " + (terminal-maxTime));
}
}
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
// 8h*60 = 480min
int maxTime = 480;
String time;
while ((time = br.readLine()) != null) {
String[] hour = time.split(":");
int terminal = Integer.parseInt(hour[0])*60 + Integer.parseInt(hour[1]) + 60;
printAnswer(terminal, maxTime);
}
}
}
Comments
Post a Comment