PROGRAMMING CODE/JAVA

[BAEKJOON] No.2884 JAVA

daye_ 2021. 10. 14. 16:31

알람시계

import java.util.Scanner;

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) {
			if(H==0) H=23;
			else H-=1;
			System.out.println(H+" "+(60+M-45));
		}
		else if(M>=45)
			System.out.println(H+" "+(M-45));
		sc.close();
	}
}