結果

問題 No.48 ロボットの操縦
ユーザー tentententen
提出日時 2020-11-10 12:22:19
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 477 bytes
コンパイル時間 2,365 ms
コンパイル使用メモリ 71,052 KB
実行使用メモリ 56,524 KB
最終ジャッジ日時 2023-09-29 23:27:08
合計ジャッジ時間 5,444 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 107 ms
55,924 KB
testcase_01 AC 108 ms
56,376 KB
testcase_02 WA -
testcase_03 AC 107 ms
56,156 KB
testcase_04 AC 105 ms
56,004 KB
testcase_05 AC 105 ms
56,252 KB
testcase_06 AC 105 ms
56,128 KB
testcase_07 AC 109 ms
56,056 KB
testcase_08 AC 106 ms
55,716 KB
testcase_09 AC 106 ms
56,524 KB
testcase_10 AC 106 ms
56,040 KB
testcase_11 AC 107 ms
56,176 KB
testcase_12 AC 110 ms
55,916 KB
testcase_13 AC 104 ms
55,940 KB
testcase_14 AC 116 ms
55,720 KB
testcase_15 AC 107 ms
55,884 KB
testcase_16 AC 107 ms
55,752 KB
testcase_17 AC 107 ms
56,072 KB
testcase_18 AC 107 ms
55,908 KB
testcase_19 AC 110 ms
55,852 KB
testcase_20 AC 110 ms
55,516 KB
testcase_21 AC 109 ms
56,128 KB
testcase_22 AC 118 ms
55,700 KB
testcase_23 AC 106 ms
55,724 KB
testcase_24 AC 109 ms
55,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = Math.abs(sc.nextInt());
        int y = sc.nextInt();
        int k = sc.nextInt();
        int ans = 0;
        if (y < 0) {
            ans++;
            y = -y;
        }
        ans += (y + k - 1) / k;
        if (x != 0) {
            ans++;
        }
        ans += (x + k - 1) / k;
        System.out.println(ans);
    }
}
0