結果

問題 No.48 ロボットの操縦
ユーザー GrenacheGrenache
提出日時 2015-06-30 23:19:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 137 ms / 5,000 ms
コード長 909 bytes
コンパイル時間 3,433 ms
コンパイル使用メモリ 77,348 KB
実行使用メモリ 41,708 KB
最終ジャッジ日時 2024-05-01 13:39:27
合計ジャッジ時間 7,555 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
41,208 KB
testcase_01 AC 127 ms
41,420 KB
testcase_02 AC 128 ms
41,580 KB
testcase_03 AC 132 ms
41,388 KB
testcase_04 AC 135 ms
41,356 KB
testcase_05 AC 114 ms
41,348 KB
testcase_06 AC 130 ms
41,600 KB
testcase_07 AC 127 ms
41,508 KB
testcase_08 AC 129 ms
41,668 KB
testcase_09 AC 132 ms
41,708 KB
testcase_10 AC 117 ms
41,364 KB
testcase_11 AC 134 ms
41,504 KB
testcase_12 AC 132 ms
41,504 KB
testcase_13 AC 131 ms
41,348 KB
testcase_14 AC 132 ms
41,532 KB
testcase_15 AC 137 ms
41,704 KB
testcase_16 AC 129 ms
41,424 KB
testcase_17 AC 125 ms
41,532 KB
testcase_18 AC 133 ms
41,296 KB
testcase_19 AC 129 ms
41,576 KB
testcase_20 AC 122 ms
41,636 KB
testcase_21 AC 128 ms
41,088 KB
testcase_22 AC 126 ms
41,452 KB
testcase_23 AC 128 ms
41,172 KB
testcase_24 AC 126 ms
41,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Main_yukicoder48 {

    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 ret = 0;
        if (x == 0 && y == 0) {
        } else if (x == 0 && y > 0) {
        	ret = (y + l - 1) / l;
        } else if (x == 0 && y < 0) {
        	ret = 2;
        	ret += (Math.abs(y) + l - 1) / l;
        } else if (x != 0 && y == 0) {
        	ret = 1;
        	ret += (Math.abs(x) + l - 1) / l;
        } else if (x != 0 && y > 0) {
        	ret = 1;
        	ret += (Math.abs(y) + l - 1) / l;
        	ret += (Math.abs(x) + l - 1) / l;
        } else {
        	ret = 2;
        	ret += (Math.abs(y) + l - 1) / l;
        	ret += (Math.abs(x) + l - 1) / l;
        }

        System.out.println(ret);
        
        sc.close();
    }
}
0