結果

問題 No.48 ロボットの操縦
ユーザー YOSHIYOSHI
提出日時 2021-02-25 22:44:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 57 ms / 5,000 ms
コード長 702 bytes
コンパイル時間 4,299 ms
コンパイル使用メモリ 75,184 KB
実行使用メモリ 50,416 KB
最終ジャッジ日時 2024-04-08 23:45:48
合計ジャッジ時間 5,866 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
50,140 KB
testcase_01 AC 53 ms
49,892 KB
testcase_02 AC 52 ms
50,028 KB
testcase_03 AC 53 ms
50,032 KB
testcase_04 AC 53 ms
50,040 KB
testcase_05 AC 55 ms
50,024 KB
testcase_06 AC 55 ms
50,140 KB
testcase_07 AC 55 ms
49,912 KB
testcase_08 AC 52 ms
50,124 KB
testcase_09 AC 53 ms
49,812 KB
testcase_10 AC 55 ms
49,708 KB
testcase_11 AC 53 ms
49,984 KB
testcase_12 AC 54 ms
50,136 KB
testcase_13 AC 54 ms
50,064 KB
testcase_14 AC 53 ms
49,688 KB
testcase_15 AC 51 ms
50,416 KB
testcase_16 AC 54 ms
50,004 KB
testcase_17 AC 53 ms
50,376 KB
testcase_18 AC 53 ms
49,692 KB
testcase_19 AC 52 ms
49,992 KB
testcase_20 AC 52 ms
49,880 KB
testcase_21 AC 57 ms
50,208 KB
testcase_22 AC 52 ms
50,056 KB
testcase_23 AC 54 ms
49,796 KB
testcase_24 AC 52 ms
50,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class No00000048_Main2 {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int x = Integer.parseInt(br.readLine());
        int y = Integer.parseInt(br.readLine());
        int l = Integer.parseInt(br.readLine());

		int cnt = 0;
		if(x != 0 || y != 0) {
			if(y >= 0) {
				if(x != 0) {
					cnt += 1;
				}
			} else {
				cnt += 2;
			}
			cnt += (Math.abs(x) / l) + (Math.abs(x) % l == 0 ? 0 : 1);
			cnt += (Math.abs(y) / l) + (Math.abs(y) % l == 0 ? 0 : 1);
		}

		System.out.println(cnt);

	}

}
0