結果
問題 |
No.63 ポッキーゲーム
|
ユーザー |
![]() |
提出日時 | 2018-05-14 15:56:57 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,152 bytes |
コンパイル時間 | 3,510 ms |
コンパイル使用メモリ | 74,988 KB |
実行使用メモリ | 54,500 KB |
最終ジャッジ日時 | 2024-06-28 11:44:10 |
合計ジャッジ時間 | 7,190 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 WA * 6 |
ソースコード
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(); int 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); } if((L / K) % 2 == 0){ Result = L / 2 - K; }else{ Result = L / (2 * K); Result *= K; } System.out.println(Result); }catch(InputMismatchException e){ System.out.println("数値を入力してください"); }catch(Exception E){ System.out.println("想定外のエラーです"); } } }