Algorithm
백준 알람 45분 빨리 2884
hyunjun's developing 🏣
2023. 8. 24. 15:11
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int H = in.nextInt(); // 시
int M = in.nextInt(); // 분
in.close();
if(M < 45) {
H--; // 시(hour) 1 감소
M= 60 - (45 - M); // 분(min) 감소
if(H < 0) {
H = 23;
}
System.out.println(H + " " + M);
}
else {
System.out.println(H + " " + (M - 45));
}
}
}
|
cs |