結果
問題 | No.48 ロボットの操縦 |
ユーザー |
![]() |
提出日時 | 2019-03-15 17:54:48 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 133 ms / 5,000 ms |
コード長 | 882 bytes |
コンパイル時間 | 2,164 ms |
コンパイル使用メモリ | 74,568 KB |
実行使用メモリ | 41,588 KB |
最終ジャッジ日時 | 2024-07-01 20:04:28 |
合計ジャッジ時間 | 6,296 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
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) {turnCnt++;}if (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);}}