Study📚/백준

[백준] - #2884: 알람 시계

woo!na 2024. 5. 13. 13:40

문제 출처 : https://www.acmicpc.net/

 


#2884: 알람 시계 (언어 : Java11)


제출 답안

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)>=0)
            System.out.printf("%d %d%n",h,(m-45));
        else if ((m-45)<0)
            if (h==0)
                System.out.printf("%d %d%n",23,(m+15));
            else 
                System.out.printf("%d %d%n",(h-1),(m+15));
    }
}

comment

-

'Study📚 > 백준' 카테고리의 다른 글

[백준] - #2588: 곱셈  (0) 2024.05.13
[백준] - #2753: 윤년  (0) 2024.05.13
[백준] - #9498: 시험 성적  (0) 2024.05.12
[백준] - #2438: 별 찍기 - 1  (0) 2024.05.12
[백준] - #10430: 나머지  (0) 2024.05.12