JAVA
[백준] 2884번: 알람 시계 - java
몰빼미
2022. 9. 7. 20:24
https://www.acmicpc.net/problem/2884
2884번: 알람 시계
상근이는 매일 아침 알람을 듣고 일어난다. 알람을 듣고 바로 일어나면 다행이겠지만, 항상 조금만 더 자려는 마음 때문에 매일 학교를 지각하고 있다. 상근이는 모든 방법을 동원해보았지만,
www.acmicpc.net
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int h = sc.nextInt();
int m = sc.nextInt();
if(m < 45){
h--;
m=60-(45-m);
if(h<0) {
h = 23;
}
System.out.println(h+" "+m);
}else{
System.out.println(h+" "+(m-45));
}
sc.close();
}
}
|
cs |