본문 바로가기
알고리즘 & 자료구조/백준

백준 2525

by 신재권 2022. 6. 26.

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main2525 {
   public static void main(String[] args) throws Exception {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      StringTokenizer st = new StringTokenizer(br.readLine());
      int A = Integer.parseInt(st.nextToken());
      int B = Integer.parseInt(st.nextToken());
      int C = Integer.parseInt(br.readLine());

      B += C;

      if (B >= 60) {
         A += B / 60;
         B %= 60;
      }
      if (A >= 24) {
         A -= 24;
      }
      System.out.printf("%d %d", A, B);
   }

}

'알고리즘 & 자료구조 > 백준' 카테고리의 다른 글

백준 1904  (0) 2022.06.27
백준 9184  (0) 2022.06.27
백준 24416  (0) 2022.06.26
백준 7569  (0) 2022.06.22
백준 1012  (0) 2022.06.20