본문 바로가기
Beakjoon&프로그래머스/Java

[백준/Java] 2525번 오븐 시계

by 현장 2022. 4. 16.

-Code

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        int hour = (a * 60 + b + c) / 60;
        int min = (a * 60 + b + c) % 60;

        if (hour >= 24) {
            hour -= 24;
        }

        System.out.println(hour + " " + min);
    }
}