結果

問題 No.46 はじめのn歩
ユーザー CecilCecil
提出日時 2022-12-19 09:53:37
言語 Java21
(openjdk 21)
結果
AC  
実行時間 589 ms / 5,000 ms
コード長 561 bytes
コンパイル時間 4,953 ms
コンパイル使用メモリ 84,108 KB
実行使用メモリ 41,320 KB
最終ジャッジ日時 2024-04-29 02:05:25
合計ジャッジ時間 4,871 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
39,820 KB
testcase_01 AC 114 ms
39,816 KB
testcase_02 AC 127 ms
41,304 KB
testcase_03 AC 129 ms
41,200 KB
testcase_04 AC 130 ms
41,228 KB
testcase_05 AC 128 ms
41,204 KB
testcase_06 AC 127 ms
40,940 KB
testcase_07 AC 125 ms
41,320 KB
testcase_08 AC 589 ms
40,200 KB
testcase_09 AC 113 ms
40,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);

		int a = scan.hasNextInt() ? scan.nextInt() : -1;
		int b = scan.hasNextInt() ? scan.nextInt() : -1;
		double c= Math.pow(10, 9);
		if (a > c || a < 1 || b > c || b < 1) {
			System.out.println("入力エラー");
			return;
		}
		
		int step = 0,count = 0;
		
		while(true){
		    if(step < b){
		        step += a;
		        count += 1;
		    }else{
		        break; 
		    }
		}

		// 結果出力
		System.out.println(count);

	}
}
0