結果

問題 No.48 ロボットの操縦
ユーザー Flere0114Flere0114
提出日時 2016-02-10 17:48:10
言語 Java21
(openjdk 21)
結果
AC  
実行時間 120 ms / 5,000 ms
コード長 516 bytes
コンパイル時間 3,270 ms
コンパイル使用メモリ 74,776 KB
実行使用メモリ 54,328 KB
最終ジャッジ日時 2024-05-01 13:49:28
合計ジャッジ時間 6,564 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
54,132 KB
testcase_01 AC 111 ms
53,856 KB
testcase_02 AC 109 ms
53,520 KB
testcase_03 AC 101 ms
52,904 KB
testcase_04 AC 110 ms
53,848 KB
testcase_05 AC 112 ms
54,200 KB
testcase_06 AC 110 ms
54,272 KB
testcase_07 AC 104 ms
52,708 KB
testcase_08 AC 111 ms
53,956 KB
testcase_09 AC 103 ms
52,828 KB
testcase_10 AC 111 ms
53,696 KB
testcase_11 AC 108 ms
52,996 KB
testcase_12 AC 101 ms
54,328 KB
testcase_13 AC 98 ms
52,620 KB
testcase_14 AC 101 ms
52,808 KB
testcase_15 AC 114 ms
54,020 KB
testcase_16 AC 110 ms
54,060 KB
testcase_17 AC 111 ms
53,984 KB
testcase_18 AC 114 ms
54,004 KB
testcase_19 AC 120 ms
53,840 KB
testcase_20 AC 108 ms
53,772 KB
testcase_21 AC 112 ms
54,156 KB
testcase_22 AC 109 ms
54,092 KB
testcase_23 AC 113 ms
53,908 KB
testcase_24 AC 112 ms
53,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No48 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int Y = sc.nextInt();
        int L = sc.nextInt();
        int ans = 0;

        ans += (Math.abs(Y) + L - 1) / L;
        ans += (Math.abs(X) + L - 1) / L;
        if(X != 0){
            ans++;
        }else if(Y < 0){
            ans++;
        }
        if(Y < 0){
            ans++;
        }

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