結果
| 問題 |
No.63 ポッキーゲーム
|
| コンテスト | |
| ユーザー |
SagToki
|
| 提出日時 | 2018-05-14 17:41:14 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 134 ms / 5,000 ms |
| コード長 | 1,161 bytes |
| コンパイル時間 | 3,867 ms |
| コンパイル使用メモリ | 74,816 KB |
| 実行使用メモリ | 54,568 KB |
| 最終ジャッジ日時 | 2024-06-28 11:47:10 |
| 合計ジャッジ時間 | 7,307 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 22 |
ソースコード
import java.util.Scanner;
import java.util.InputMismatchException;
public class PockyGame {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
try{
int L = scanner.nextInt();
int K = scanner.nextInt();
double Result = 0;
if(L < 1 || L > Math.pow(10,9)){
System.out.println("Lは1から1000000000の範囲で入力してください");
System.exit(0);
}
if(K < 1 || K > 50){
System.out.println("Kは1から50の範囲で入力してください");
System.exit(0);
}
//Result = Math.ceil( L / (K * 2) ) - 1 ;
Result = (K * 2);
Result = L / Result;
Result = Math.ceil(Result);
Result --;
Result *= K ;
System.out.println((int)Result);
}catch(InputMismatchException e){
System.out.println("数値を入力してください");
}catch(Exception E){
System.out.println("想定外のエラーです");
}
}
}
SagToki