main
[백준-2530번/Java] 인공지능 시계 본문
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