Notice
Recent Posts
Recent Comments
Link
«   2024/12   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

main

[백준-2530번/Java] 인공지능 시계 본문

Algorithm

[백준-2530번/Java] 인공지능 시계

1984 2022. 11. 9. 18:54
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int hour = sc.nextInt();
		int min = sc.nextInt();
		int sec = sc.nextInt();
		int time = sc.nextInt();

		int alarm_time = (hour * 60 * 60) + (min * 60) + sec + time;
		while (alarm_time >= 24 * 60 * 60) {
			alarm_time -= 24 * 60 * 60;
		}
		System.out.printf("%d %d %d%n", alarm_time / (60 * 60), alarm_time % (60 * 60) / 60, alarm_time % 60);

		sc.close();

	}

}
728x90

'Algorithm' 카테고리의 다른 글

[백준-5355번/Java] 화성수학  (0) 2022.11.09
[백준-2914번/Java] 저작권  (0) 2022.11.09
[백준-2525번/Java] 오븐 시계  (0) 2022.11.09
[백준-1259번/Java] 팰린드롬수  (0) 2022.11.09
[Java] 배열 자르기  (0) 2022.11.07
Comments