結果

問題 No.48 ロボットの操縦
ユーザー Flere0114Flere0114
提出日時 2016-02-10 17:48:10
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 5,000 ms
コード長 516 bytes
コンパイル時間 3,247 ms
コンパイル使用メモリ 72,036 KB
実行使用メモリ 56,116 KB
最終ジャッジ日時 2023-08-14 00:22:32
合計ジャッジ時間 7,552 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,812 KB
testcase_01 AC 124 ms
55,888 KB
testcase_02 AC 123 ms
55,676 KB
testcase_03 AC 123 ms
56,008 KB
testcase_04 AC 123 ms
55,884 KB
testcase_05 AC 124 ms
55,652 KB
testcase_06 AC 122 ms
55,648 KB
testcase_07 AC 122 ms
56,116 KB
testcase_08 AC 123 ms
56,020 KB
testcase_09 AC 122 ms
56,052 KB
testcase_10 AC 123 ms
55,916 KB
testcase_11 AC 123 ms
55,972 KB
testcase_12 AC 124 ms
55,696 KB
testcase_13 AC 125 ms
55,584 KB
testcase_14 AC 125 ms
55,484 KB
testcase_15 AC 122 ms
55,720 KB
testcase_16 AC 123 ms
55,740 KB
testcase_17 AC 125 ms
55,972 KB
testcase_18 AC 126 ms
56,088 KB
testcase_19 AC 123 ms
55,728 KB
testcase_20 AC 124 ms
55,860 KB
testcase_21 AC 125 ms
55,980 KB
testcase_22 AC 124 ms
55,800 KB
testcase_23 AC 125 ms
55,876 KB
testcase_24 AC 125 ms
55,580 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