elesis's haunt

2884 알람 시계 본문

백준~문풀 후 최적화 추가~/단계별로 풀어보기

2884 알람 시계

elesis 2021. 4. 15. 16:23
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 ) {
            m -= 45;
        } else {
            if( h == 0 ) {
                h = 23;
                m = 60-45+m;
            } else {
                h -= 1;
                m = 60-45+m;
            }
        }
        System.out.print(h+" "+m);
    }
}

 

'백준~문풀 후 최적화 추가~ > 단계별로 풀어보기' 카테고리의 다른 글

10950 A+B-3  (0) 2021.04.19
2739 구구단  (0) 2021.04.19
14681 사분면 고르기  (0) 2021.04.15
2753 윤년  (0) 2021.04.15
9498 시험 성적9498 시험 성적  (0) 2021.04.14
Comments