結果

問題 No.48 ロボットの操縦
ユーザー takeya_okinotakeya_okino
提出日時 2017-06-20 17:07:00
言語 Java21
(openjdk 21)
結果
AC  
実行時間 133 ms / 5,000 ms
コード長 385 bytes
コンパイル時間 2,100 ms
コンパイル使用メモリ 74,488 KB
実行使用メモリ 54,500 KB
最終ジャッジ日時 2024-04-10 05:46:07
合計ジャッジ時間 6,240 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
54,176 KB
testcase_01 AC 131 ms
54,104 KB
testcase_02 AC 129 ms
54,156 KB
testcase_03 AC 133 ms
54,500 KB
testcase_04 AC 130 ms
53,792 KB
testcase_05 AC 131 ms
53,972 KB
testcase_06 AC 131 ms
54,076 KB
testcase_07 AC 131 ms
53,740 KB
testcase_08 AC 130 ms
54,280 KB
testcase_09 AC 128 ms
53,848 KB
testcase_10 AC 132 ms
53,904 KB
testcase_11 AC 130 ms
53,880 KB
testcase_12 AC 131 ms
54,232 KB
testcase_13 AC 128 ms
54,020 KB
testcase_14 AC 133 ms
54,372 KB
testcase_15 AC 131 ms
54,036 KB
testcase_16 AC 116 ms
52,708 KB
testcase_17 AC 129 ms
54,136 KB
testcase_18 AC 129 ms
54,012 KB
testcase_19 AC 130 ms
54,284 KB
testcase_20 AC 131 ms
54,164 KB
testcase_21 AC 129 ms
53,920 KB
testcase_22 AC 129 ms
54,032 KB
testcase_23 AC 130 ms
54,040 KB
testcase_24 AC 129 ms
54,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int y = sc.nextInt();
    int l = sc.nextInt();
    int ans = (Math.abs(x) + l - 1) / l + (Math.abs(y) + l - 1) / l;
    if(y < 0) {
      ans += 2;
    } else if(x != 0) {
      ans += 1;
    }
    System.out.println(ans);
  }
}
0