結果

問題 No.48 ロボットの操縦
ユーザー dazydazy
提出日時 2016-09-04 02:33:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 125 ms / 5,000 ms
コード長 927 bytes
コンパイル時間 2,812 ms
コンパイル使用メモリ 74,988 KB
実行使用メモリ 54,304 KB
最終ジャッジ日時 2024-05-01 14:02:42
合計ジャッジ時間 6,288 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
53,808 KB
testcase_01 AC 111 ms
53,920 KB
testcase_02 AC 101 ms
52,808 KB
testcase_03 AC 101 ms
52,620 KB
testcase_04 AC 113 ms
53,944 KB
testcase_05 AC 106 ms
53,100 KB
testcase_06 AC 99 ms
53,024 KB
testcase_07 AC 95 ms
52,532 KB
testcase_08 AC 96 ms
52,188 KB
testcase_09 AC 114 ms
53,932 KB
testcase_10 AC 111 ms
53,856 KB
testcase_11 AC 105 ms
52,756 KB
testcase_12 AC 99 ms
52,772 KB
testcase_13 AC 100 ms
52,916 KB
testcase_14 AC 110 ms
53,064 KB
testcase_15 AC 109 ms
52,752 KB
testcase_16 AC 109 ms
53,976 KB
testcase_17 AC 117 ms
53,984 KB
testcase_18 AC 121 ms
54,124 KB
testcase_19 AC 115 ms
54,052 KB
testcase_20 AC 98 ms
52,856 KB
testcase_21 AC 125 ms
54,304 KB
testcase_22 AC 100 ms
52,752 KB
testcase_23 AC 107 ms
52,996 KB
testcase_24 AC 113 ms
53,804 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