結果

問題 No.48 ロボットの操縦
ユーザー yagi2yagi2
提出日時 2017-04-26 11:01:49
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 724 bytes
コンパイル時間 2,773 ms
コンパイル使用メモリ 72,408 KB
実行使用メモリ 57,976 KB
最終ジャッジ日時 2023-10-11 15:09:44
合計ジャッジ時間 7,015 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,596 KB
testcase_01 AC 118 ms
55,744 KB
testcase_02 AC 117 ms
55,656 KB
testcase_03 WA -
testcase_04 AC 118 ms
55,744 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 118 ms
55,756 KB
testcase_08 WA -
testcase_09 AC 119 ms
55,592 KB
testcase_10 WA -
testcase_11 AC 120 ms
55,900 KB
testcase_12 AC 120 ms
55,800 KB
testcase_13 AC 121 ms
55,600 KB
testcase_14 AC 121 ms
53,676 KB
testcase_15 AC 121 ms
57,500 KB
testcase_16 AC 121 ms
55,796 KB
testcase_17 AC 122 ms
55,544 KB
testcase_18 WA -
testcase_19 AC 121 ms
55,420 KB
testcase_20 AC 121 ms
55,748 KB
testcase_21 AC 121 ms
55,544 KB
testcase_22 WA -
testcase_23 AC 119 ms
55,516 KB
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder.No48;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int X = Integer.parseInt(sc.next());
        int Y = Integer.parseInt(sc.next());
        int L = Integer.parseInt(sc.next());

        int sum = 0;

        if (Y > 0) {
            sum += (Y / L);
            if (Y % L != 0) sum++;
        } else {
            sum += 2;
            Y = -Y;
            sum += (Y / L);
            if (Y % L != 0) sum++;
        }

        if (X != 0) {
            sum++;

            X = Math.abs(X);
            sum += (X / L);
            if (X % L != 0) sum++;
        }

        System.out.println(sum);
    }
}
0