結果

問題 No.296 n度寝
ユーザー ShotaroSuzuShotaroSuzu
提出日時 2020-05-19 19:50:04
言語 Java21
(openjdk 21)
結果
AC  
実行時間 138 ms / 1,000 ms
コード長 1,048 bytes
コンパイル時間 3,111 ms
コンパイル使用メモリ 75,048 KB
実行使用メモリ 56,956 KB
最終ジャッジ日時 2024-04-09 22:23:39
合計ジャッジ時間 5,368 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
56,956 KB
testcase_01 AC 123 ms
56,708 KB
testcase_02 AC 110 ms
55,212 KB
testcase_03 AC 107 ms
53,864 KB
testcase_04 AC 100 ms
53,108 KB
testcase_05 AC 110 ms
53,964 KB
testcase_06 AC 110 ms
54,316 KB
testcase_07 AC 104 ms
53,052 KB
testcase_08 AC 134 ms
56,252 KB
testcase_09 AC 95 ms
54,032 KB
testcase_10 AC 110 ms
54,148 KB
testcase_11 AC 115 ms
54,136 KB
testcase_12 AC 105 ms
52,764 KB
testcase_13 AC 111 ms
53,540 KB
testcase_14 AC 116 ms
54,348 KB
testcase_15 AC 110 ms
54,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder.beginner.sleepingnth;

import java.time.LocalTime;
import java.util.Scanner;

public class SleepingNth {

	public static void main(String[] args) {
		new SleepingNth().execute();

	}

	private void execute() {
		SleepingDto dto = read();

		LocalTime wakeUpTime = dto.firstWakeTime;
		for (int i = 1; i < dto.sleepingNum; i++) {
			wakeUpTime = wakeUpTime.plusMinutes(dto.alermInterval);
		}
		System.out.println(wakeUpTime.getHour());
		System.out.println(wakeUpTime.getMinute());
	}

	private SleepingDto read() {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		return new SleepingDto(sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt());
	}

	private class SleepingDto {
		private int sleepingNum;
		private LocalTime firstWakeTime;
		private int alermInterval;
		private SleepingDto(int sleepingNum, int firstWakeHour, int firstWakeMin, int interval) {
			this.sleepingNum = sleepingNum;
			this.firstWakeTime = LocalTime.of(firstWakeHour, firstWakeMin);
			this.alermInterval = interval;
		}
	}
}
0