結果

問題 No.48 ロボットの操縦
ユーザー dazydazy
提出日時 2016-09-04 02:33:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 115 ms / 5,000 ms
コード長 927 bytes
コンパイル時間 4,125 ms
コンパイル使用メモリ 72,424 KB
実行使用メモリ 56,384 KB
最終ジャッジ日時 2023-08-14 00:48:58
合計ジャッジ時間 6,399 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 107 ms
56,112 KB
testcase_01 AC 111 ms
56,296 KB
testcase_02 AC 108 ms
56,148 KB
testcase_03 AC 108 ms
54,256 KB
testcase_04 AC 113 ms
55,584 KB
testcase_05 AC 115 ms
56,320 KB
testcase_06 AC 107 ms
56,056 KB
testcase_07 AC 106 ms
56,048 KB
testcase_08 AC 104 ms
56,344 KB
testcase_09 AC 103 ms
56,384 KB
testcase_10 AC 102 ms
56,152 KB
testcase_11 AC 103 ms
55,872 KB
testcase_12 AC 103 ms
55,828 KB
testcase_13 AC 105 ms
55,740 KB
testcase_14 AC 101 ms
55,928 KB
testcase_15 AC 101 ms
55,972 KB
testcase_16 AC 105 ms
56,236 KB
testcase_17 AC 106 ms
55,792 KB
testcase_18 AC 107 ms
55,912 KB
testcase_19 AC 107 ms
56,260 KB
testcase_20 AC 107 ms
56,216 KB
testcase_21 AC 114 ms
56,304 KB
testcase_22 AC 108 ms
55,872 KB
testcase_23 AC 102 ms
55,908 KB
testcase_24 AC 105 ms
55,728 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Run {
    public static void main (String arg[]) {
        Scanner scan = new Scanner(System.in);
        int X = scan.nextInt();
        int Y = scan.nextInt();
        int L = scan.nextInt();
        if (X < -1000000000||X > 1000000000||
            Y < -1000000000||Y > 1000000000||
            L < 1 || L > 1000000000) System.exit(1);

        int i = 0;
        if (Y >= 0) {
            i += Y/L;
            if (Y%L != 0) i++;
            if (X!=0) {
                X = Math.abs(X);
                i++;
                i += X/L;
                if (X%L != 0) i++;
            }
        } else {
            Y = Math.abs(Y);
            i += 2;
            if (X!=0) {
                X = Math.abs(X);
                i += X/L;
                if (X%L != 0) i++;
            }
            i += Y/L;
            if (Y%L != 0) i++;
        }

        System.out.println(i);
    }
}
0