URI_Problem_1047.java
package URI_Problem;
import java.util.Scanner;
public class prob_1047_clone {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int start_h, end_h, start_m, end_m, dur_h, dur_m;
start_h = in.nextInt();
end_h = in.nextInt();
start_m = in.nextInt();
end_m = in.nextInt();
dur_h = end_h - start_h;
if (dur_h < 0) {
dur_h += 24;
}
dur_m = end_m - start_m;
if (dur_m < 0) {
dur_m+=60;
dur_h--;
}
if(start_h == end_h && start_m == end_m){
System.out.println("O JOGO DUROU 24 HORA(S) E 0 MINUTO(S)");
}
else{
System.out.printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)", dur_h, dur_m);
}
}
}
import java.util.Scanner;
public class prob_1047_clone {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int start_h, end_h, start_m, end_m, dur_h, dur_m;
start_h = in.nextInt();
end_h = in.nextInt();
start_m = in.nextInt();
end_m = in.nextInt();
dur_h = end_h - start_h;
if (dur_h < 0) {
dur_h += 24;
}
dur_m = end_m - start_m;
if (dur_m < 0) {
dur_m+=60;
dur_h--;
}
if(start_h == end_h && start_m == end_m){
System.out.println("O JOGO DUROU 24 HORA(S) E 0 MINUTO(S)");
}
else{
System.out.printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)", dur_h, dur_m);
}
}
}
Comments
Post a Comment