結果
| 問題 |
No.46 はじめのn歩
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-05-10 17:42:20 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 127 ms / 5,000 ms |
| コード長 | 1,042 bytes |
| コンパイル時間 | 3,465 ms |
| コンパイル使用メモリ | 74,464 KB |
| 実行使用メモリ | 41,352 KB |
| 最終ジャッジ日時 | 2024-09-15 07:10:47 |
| 合計ジャッジ時間 | 5,135 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
import java.util.InputMismatchException;
import java.util.Scanner;
public class Question_01_0509_3 {
public static void main(String[] args) {
// 有効範囲
final int MIN = 0;
final int MAX = (int)Math.pow(10, 9);
Scanner sc = new Scanner(System.in);
long strideLength = 0; // 歩幅
long distance = 0; // 距離
long mStepCount; // 最小の歩数(minimum)
try {
strideLength = sc.nextLong();
distance = sc.nextLong();
// a b ともに正の整数。(1≤a,b≤10の9乗=1000000000)
if (strideLength > MIN && distance > MIN && distance <= MAX && distance <= MAX) {
mStepCount = distance / strideLength;
if (distance % strideLength != 0) {
mStepCount += 1;
}
System.out.println(mStepCount);
} else {
System.out.println("1≤a,b≤10の9乗=1000000000の範囲内で入力して下さい。");
}
} catch (InputMismatchException e) {
System.out.println("数値または、10の9乗=1000000000の範囲内で入力して下さい。");
} finally {
sc.close();
}
}
}