結果

問題 No.46 はじめのn歩
ユーザー ShotaroSuzuShotaroSuzu
提出日時 2020-05-19 18:10:56
言語 Java21
(openjdk 21)
結果
AC  
実行時間 120 ms / 5,000 ms
コード長 808 bytes
コンパイル時間 3,026 ms
コンパイル使用メモリ 77,288 KB
実行使用メモリ 54,352 KB
最終ジャッジ日時 2024-04-09 22:21:18
合計ジャッジ時間 4,934 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
54,156 KB
testcase_01 AC 115 ms
54,004 KB
testcase_02 AC 114 ms
53,544 KB
testcase_03 AC 117 ms
54,352 KB
testcase_04 AC 108 ms
52,928 KB
testcase_05 AC 118 ms
53,900 KB
testcase_06 AC 109 ms
52,832 KB
testcase_07 AC 120 ms
53,860 KB
testcase_08 AC 106 ms
52,956 KB
testcase_09 AC 118 ms
53,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder.beginner.firststep;

import java.util.Scanner;

public class CalcSteps {

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

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

		boolean isJust = dto.length % dto.lengthPerStep == 0;
		long steps = dto.length / dto.lengthPerStep;

		 if(isJust) {
			 System.out.println(steps);
		 } else {
			 System.out.println(steps + 1);
		 }
	}

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

	private class CalcStepsDto {
		private long length;
		private long lengthPerStep;

		private CalcStepsDto(long lengthPerStep, long length) {
			this.lengthPerStep = lengthPerStep;
			this.length = length;
		}
	}
}
0