結果

問題 No.48 ロボットの操縦
ユーザー fkwnw3_1243fkwnw3_1243
提出日時 2017-04-23 21:45:37
言語 Java21
(openjdk 21)
結果
AC  
実行時間 42 ms / 5,000 ms
コード長 1,279 bytes
コンパイル時間 1,817 ms
コンパイル使用メモリ 73,828 KB
実行使用メモリ 49,768 KB
最終ジャッジ日時 2023-09-29 16:02:42
合計ジャッジ時間 4,149 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
47,348 KB
testcase_01 AC 39 ms
49,408 KB
testcase_02 AC 40 ms
49,292 KB
testcase_03 AC 39 ms
49,196 KB
testcase_04 AC 40 ms
49,136 KB
testcase_05 AC 40 ms
49,476 KB
testcase_06 AC 39 ms
49,284 KB
testcase_07 AC 39 ms
49,280 KB
testcase_08 AC 39 ms
49,068 KB
testcase_09 AC 38 ms
49,208 KB
testcase_10 AC 39 ms
49,092 KB
testcase_11 AC 39 ms
47,420 KB
testcase_12 AC 38 ms
49,200 KB
testcase_13 AC 38 ms
49,296 KB
testcase_14 AC 42 ms
49,768 KB
testcase_15 AC 39 ms
49,268 KB
testcase_16 AC 38 ms
47,236 KB
testcase_17 AC 39 ms
49,088 KB
testcase_18 AC 39 ms
49,296 KB
testcase_19 AC 39 ms
49,084 KB
testcase_20 AC 38 ms
49,220 KB
testcase_21 AC 38 ms
47,080 KB
testcase_22 AC 39 ms
49,532 KB
testcase_23 AC 38 ms
49,200 KB
testcase_24 AC 39 ms
49,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int X = Integer.parseInt(reader.readLine());
        int Y = Integer.parseInt(reader.readLine());
        int L = Integer.parseInt(reader.readLine());

        int minimumCommandCounter = 0;

        if (X >0 && Y > 0) {
            minimumCommandCounter += 1;
        } else if (X > 0 && Y < 0) {
            minimumCommandCounter+=2;
        } else if (X < 0 && Y > 0) {
            minimumCommandCounter+=1;
        } else if (X< 0 && Y < 0) {
            minimumCommandCounter+=2;
        } else if (X < 0 && Y == 0) {
            minimumCommandCounter+=1;
        } else if (X > 0 && Y ==0) {
            minimumCommandCounter+=1;
        } else if (X == 0 && Y > 0) {
            minimumCommandCounter+=0;
        } else if (X==0 && Y <0 ) {
            minimumCommandCounter+=2;
        }


        X = Math.abs(X);
        Y = Math.abs(Y);
        minimumCommandCounter += (X + L - 1) / L;
        minimumCommandCounter += (Y + L - 1) / L;
        System.out.println(minimumCommandCounter);
    }
}
0