結果

問題 No.48 ロボットの操縦
ユーザー Hiroaki KonoHiroaki Kono
提出日時 2017-10-26 23:15:55
言語 Java21
(openjdk 21)
結果
AC  
実行時間 128 ms / 5,000 ms
コード長 512 bytes
コンパイル時間 3,387 ms
コンパイル使用メモリ 72,384 KB
実行使用メモリ 55,968 KB
最終ジャッジ日時 2023-08-14 02:18:25
合計ジャッジ時間 8,105 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,776 KB
testcase_01 AC 125 ms
55,668 KB
testcase_02 AC 126 ms
55,856 KB
testcase_03 AC 126 ms
55,460 KB
testcase_04 AC 127 ms
55,852 KB
testcase_05 AC 127 ms
55,784 KB
testcase_06 AC 126 ms
55,532 KB
testcase_07 AC 127 ms
55,568 KB
testcase_08 AC 126 ms
55,968 KB
testcase_09 AC 128 ms
55,672 KB
testcase_10 AC 124 ms
55,776 KB
testcase_11 AC 127 ms
55,900 KB
testcase_12 AC 126 ms
55,932 KB
testcase_13 AC 126 ms
55,812 KB
testcase_14 AC 125 ms
55,780 KB
testcase_15 AC 126 ms
55,708 KB
testcase_16 AC 127 ms
55,828 KB
testcase_17 AC 125 ms
55,548 KB
testcase_18 AC 126 ms
55,376 KB
testcase_19 AC 124 ms
55,748 KB
testcase_20 AC 125 ms
55,636 KB
testcase_21 AC 126 ms
55,904 KB
testcase_22 AC 126 ms
55,544 KB
testcase_23 AC 126 ms
55,536 KB
testcase_24 AC 125 ms
55,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No48 {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int x = s.nextInt();
        int y = s.nextInt();
        int l = s.nextInt();

        int turn = 0;
        if (y < 0) {
            turn = 2;
        } else if (x != 0) {
            turn = 1;
        }

        x = Math.abs(x);
        y = Math.abs(y);

        int steps = ((x + l - 1) / l) + ((y + l - 1) / l) + turn;
        System.out.println(steps);
    }
}
0