ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 백준 2525 JAVA
    ETC/Algorithm 2023. 5. 19. 23:12
    import java.io.*;
    import java.util.StringTokenizer;
    
    public class Main {
        public static void main(String[] args) throws IOException {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
    
            StringTokenizer st = new StringTokenizer(br.readLine(), " ");
    
            int h = Integer.parseInt(st.nextToken());
            int m = Integer.parseInt(st.nextToken());
            int add = Integer.parseInt(br.readLine());
    
            if (add >= 60) {
                h += (add / 60);
                m += (add % 60);
            } else {
                m += add % 60;
            }
            if (m >= 60) {
                h += 1;
                m = m-60;
            }
            if (h >= 24) {
                h -= 24;
            }
            bw.write(h + " " + m);
            bw.flush();
        }
    }

    댓글

Designed by black7375.