結果

問題 No.48 ロボットの操縦
ユーザー l1267976l1267976
提出日時 2017-03-09 15:38:04
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 615 bytes
コンパイル時間 3,221 ms
コンパイル使用メモリ 72,048 KB
実行使用メモリ 56,544 KB
最終ジャッジ日時 2023-09-06 05:24:54
合計ジャッジ時間 7,596 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
56,448 KB
testcase_01 AC 121 ms
55,656 KB
testcase_02 AC 122 ms
55,696 KB
testcase_03 AC 123 ms
55,768 KB
testcase_04 AC 123 ms
56,012 KB
testcase_05 AC 122 ms
55,852 KB
testcase_06 WA -
testcase_07 AC 117 ms
55,408 KB
testcase_08 AC 123 ms
55,824 KB
testcase_09 AC 123 ms
55,976 KB
testcase_10 AC 122 ms
55,684 KB
testcase_11 AC 122 ms
55,936 KB
testcase_12 AC 124 ms
55,980 KB
testcase_13 AC 124 ms
55,956 KB
testcase_14 AC 125 ms
55,572 KB
testcase_15 AC 124 ms
55,512 KB
testcase_16 AC 122 ms
56,044 KB
testcase_17 AC 122 ms
55,572 KB
testcase_18 AC 123 ms
56,024 KB
testcase_19 AC 122 ms
56,116 KB
testcase_20 AC 124 ms
55,552 KB
testcase_21 AC 123 ms
55,808 KB
testcase_22 AC 123 ms
56,096 KB
testcase_23 AC 123 ms
55,924 KB
testcase_24 AC 124 ms
55,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No48 {

    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 cnt = 0;

        int xMove = Math.abs(x / l);
        if (x % l != 0) xMove++;
        cnt += xMove;

        int yMove = Math.abs(y / l);
        if (y % l != 0) yMove++;
        cnt += yMove;

        if (x != 0 && y > 0) {
            cnt++;
        }

        if (y < 0) {
            cnt += 2;
        }

        System.out.println(cnt);

        sc.close();
    }

}
0