Written by
java-style
on
on
[백준 BAEKJOON] 2884번 알람 시계 문제 (JAVA)
[백준 BAEKJOON] 2884번 알람 시계 문제 (JAVA)
문제
소스코드
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(); sc.close(); if (m < 45) { h--; if(h < 0) { h = 24 + h; } m = 60 + (m-45); System.out.printf("%d ",h); System.out.printf("%d", m); } else { System.out.printf("%d ",h); System.out.printf("%d", m-45); } } //main } //class
24시간과 60분의 개념을 조금 생각해보면 풀 수 있는 문제였다.
from http://choitaetae.tistory.com/39 by ccl(A) rewrite - 2021-09-05 23:00:36