結果
問題 | No.48 ロボットの操縦 |
ユーザー |
![]() |
提出日時 | 2019-03-15 17:49:34 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 861 bytes |
コンパイル時間 | 2,081 ms |
コンパイル使用メモリ | 74,628 KB |
実行使用メモリ | 41,408 KB |
最終ジャッジ日時 | 2024-07-01 20:03:50 |
合計ジャッジ時間 | 6,441 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 WA * 3 |
ソースコード
import java.util.*; class Main { private static final String SPLIT_STR = " "; public static void main(String[] args) { // Scanner生成 Scanner sc = new Scanner(System.in); // 入力設定 String input = sc.nextLine(); int X = Integer.parseInt(input); sc.reset(); input = sc.nextLine(); int Y = Integer.parseInt(input); sc.reset(); input = sc.nextLine(); int L = Integer.parseInt(input); // Scannerクローズ sc.close(); /* メイン処理開始 */ // 変数初期化 int result = 0; int turnCnt = 0; // 結果設定 if (X != 0 || (X == 0 && Y >= 0)) { turnCnt++; } if (X < 0) { X *= -1; } if (Y < 0) { Y *= -1; turnCnt++; } result = (int)Math.ceil((double)X / L) + (int)Math.ceil((double)Y / L) + turnCnt; /* メイン処理終了 */ // 結果出力 System.out.println(result); } }