-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
37 lines (28 loc) · 814 Bytes
/
Main.java
File metadata and controls
37 lines (28 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package beecrowd1019;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int duracao = sc.nextInt();
sc.close();
int HORAEMSEG = 3600;
int MINEMSEG = 60;
int hora, min, seg = 0;
if(duracao >= 3600) {
hora = duracao / HORAEMSEG;
duracao = duracao % HORAEMSEG;
} else {
hora = 0;
}
if(duracao > MINEMSEG) {
min = duracao / MINEMSEG;
duracao = duracao % MINEMSEG;
} else {
min = 0;
}
if(duracao < MINEMSEG) {
seg = duracao;
}
System.out.printf("%d:%d:%d%n", hora, min, seg);
}
}