Playground/자바문제집

[백준] 2525번

미숫가루설탕많이 2022. 12. 25. 11:18
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(); // 분
        int A = sc.nextInt(); // 요리에 필요한 시간
        sc.close();

        H += (A / 60);
        M += (A % 60);

        if (M > 59) {
            H++;
            M -= 60;
        }
        if (H > 23) {
            H -= 24;
        }
        System.out.println(H + " " + M);
    }

}

 

'Playground > 자바문제집' 카테고리의 다른 글

[백준] 8393번  (0) 2022.12.25
[백준] 10950번  (0) 2022.12.25
[백준] 2884번  (0) 2022.12.24
[백준] 14681번  (0) 2022.12.24
[백준] 2753번  (0) 2022.12.24