백준2884: 알람 시계
문제
https://www.acmicpc.net/problem/2884
문제 풀이
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int hour = sc.nextInt();
int min = sc.nextInt();
if(min<45){
hour--;
min=60-(45-min);
if(hour<0) hour=23;
System.out.println(hour+" "+min);
}else{
min-=45;
System.out.println(hour+" "+min);
}
}
}
댓글남기기