백준(java)

백준 2525 java

isaacagent 2023. 8. 16. 21:06
728x90

 

import java.util.Scanner;
public class Main{
    public static void main(String[] args) throws Exception {
        int h;
        int m;
        int t;

        Scanner sc = new Scanner(System.in);

        h = sc.nextInt(); // 시간

        m = sc.nextInt(); // 분	

        t = sc.nextInt(); // input 시간


        m= m+t; // input 더함

        while(m>=60){ // m이 60미만이 될 때까지
            if(m>=60){ 
               h = h+1;
               m = m-60;
            if(h>=24){
               h =0;
            }
        }

        }
       
        System.out.println(h + " " + m);
        


}
}

'백준(java)' 카테고리의 다른 글

백준 11021 java  (0) 2023.08.19
백준 15552 java  (0) 2023.08.16
백준 2884 java  (0) 2023.08.16
백준 14681 java  (0) 2023.08.15
백준 2753 java  (0) 2023.08.15