結果

問題 No.48 ロボットの操縦
ユーザー dazydazy
提出日時 2016-09-04 02:30:08
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 948 bytes
コンパイル時間 2,960 ms
コンパイル使用メモリ 74,552 KB
実行使用メモリ 56,580 KB
最終ジャッジ日時 2024-04-27 16:12:18
合計ジャッジ時間 6,795 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
53,896 KB
testcase_01 AC 109 ms
52,968 KB
testcase_02 AC 108 ms
52,860 KB
testcase_03 RE -
testcase_04 AC 105 ms
52,456 KB
testcase_05 AC 115 ms
54,000 KB
testcase_06 AC 119 ms
53,832 KB
testcase_07 RE -
testcase_08 AC 121 ms
53,932 KB
testcase_09 RE -
testcase_10 AC 104 ms
54,244 KB
testcase_11 AC 124 ms
53,804 KB
testcase_12 AC 106 ms
52,816 KB
testcase_13 RE -
testcase_14 AC 123 ms
53,976 KB
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 AC 118 ms
53,852 KB
testcase_23 RE -
testcase_24 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Map;
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 < -100000000||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