백준 문제풀기/조건문

[Java] 백준 2525 오븐 시계

psys 2022. 11. 14. 14:41
728x90
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String[] str = br.readLine().split(" ");
		int add = Integer.parseInt(br.readLine());
		
		int h = Integer.parseInt(str[0]);
		int m = Integer.parseInt(str[1]);
		
		int result = (h*60+m)+add;
		
		System.out.println((result/60)%24 + " " + result%60);
		
	}
}