結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
49,352 KB
testcase_01 AC 41 ms
49,448 KB
testcase_02 AC 41 ms
49,228 KB
testcase_03 AC 41 ms
49,324 KB
testcase_04 AC 41 ms
49,088 KB
testcase_05 AC 41 ms
49,028 KB
testcase_06 AC 41 ms
49,364 KB
testcase_07 AC 41 ms
49,076 KB
testcase_08 AC 42 ms
49,272 KB
testcase_09 AC 42 ms
49,572 KB
testcase_10 AC 42 ms
49,532 KB
testcase_11 AC 42 ms
49,072 KB
testcase_12 AC 41 ms
49,356 KB
testcase_13 AC 41 ms
49,132 KB
testcase_14 AC 41 ms
48,964 KB
testcase_15 AC 41 ms
49,264 KB
testcase_16 AC 42 ms
47,292 KB
testcase_17 AC 41 ms
49,312 KB
testcase_18 AC 41 ms
49,344 KB
testcase_19 AC 41 ms
49,416 KB
testcase_20 AC 42 ms
49,028 KB
testcase_21 AC 42 ms
49,276 KB
testcase_22 AC 41 ms
49,116 KB
testcase_23 AC 41 ms
49,424 KB
testcase_24 AC 41 ms
49,172 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) {
            minimumCommandCounter = 1;
        }

        if (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