結果

問題 No.48 ロボットの操縦
ユーザー jonki324jonki324
提出日時 2018-06-05 16:58:03
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 5,000 ms
コード長 484 bytes
コンパイル時間 1,932 ms
コンパイル使用メモリ 71,632 KB
実行使用メモリ 56,292 KB
最終ジャッジ日時 2023-09-12 22:25:41
合計ジャッジ時間 6,274 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,708 KB
testcase_01 AC 122 ms
56,148 KB
testcase_02 AC 119 ms
55,988 KB
testcase_03 AC 121 ms
56,064 KB
testcase_04 AC 121 ms
55,744 KB
testcase_05 AC 121 ms
56,292 KB
testcase_06 AC 121 ms
55,480 KB
testcase_07 AC 121 ms
55,752 KB
testcase_08 AC 121 ms
54,128 KB
testcase_09 AC 121 ms
53,912 KB
testcase_10 AC 123 ms
55,728 KB
testcase_11 AC 120 ms
56,236 KB
testcase_12 AC 119 ms
55,792 KB
testcase_13 AC 120 ms
55,960 KB
testcase_14 AC 120 ms
55,476 KB
testcase_15 AC 121 ms
55,704 KB
testcase_16 AC 121 ms
55,948 KB
testcase_17 AC 124 ms
56,008 KB
testcase_18 AC 120 ms
55,576 KB
testcase_19 AC 122 ms
55,924 KB
testcase_20 AC 121 ms
55,476 KB
testcase_21 AC 126 ms
55,740 KB
testcase_22 AC 122 ms
55,628 KB
testcase_23 AC 124 ms
55,872 KB
testcase_24 AC 124 ms
55,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

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