結果

問題 No.48 ロボットの操縦
ユーザー yuuki121yuuki121
提出日時 2021-01-05 23:54:16
言語 Java21
(openjdk 21)
結果
AC  
実行時間 52 ms / 5,000 ms
コード長 639 bytes
コンパイル時間 2,263 ms
コンパイル使用メモリ 73,712 KB
実行使用メモリ 37,292 KB
最終ジャッジ日時 2024-04-24 02:00:10
合計ジャッジ時間 4,225 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
37,292 KB
testcase_01 AC 52 ms
36,752 KB
testcase_02 AC 51 ms
37,276 KB
testcase_03 AC 48 ms
36,808 KB
testcase_04 AC 48 ms
36,900 KB
testcase_05 AC 47 ms
36,660 KB
testcase_06 AC 47 ms
36,852 KB
testcase_07 AC 49 ms
36,680 KB
testcase_08 AC 48 ms
36,992 KB
testcase_09 AC 50 ms
36,864 KB
testcase_10 AC 48 ms
37,076 KB
testcase_11 AC 47 ms
36,940 KB
testcase_12 AC 49 ms
36,756 KB
testcase_13 AC 46 ms
36,640 KB
testcase_14 AC 48 ms
37,060 KB
testcase_15 AC 47 ms
36,728 KB
testcase_16 AC 50 ms
36,728 KB
testcase_17 AC 50 ms
36,724 KB
testcase_18 AC 51 ms
36,960 KB
testcase_19 AC 50 ms
37,044 KB
testcase_20 AC 51 ms
36,812 KB
testcase_21 AC 50 ms
37,040 KB
testcase_22 AC 50 ms
36,752 KB
testcase_23 AC 48 ms
36,992 KB
testcase_24 AC 49 ms
36,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {

	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 xl = (Math.abs(x) + l - 1) / l;
		int yl = (Math.abs(y) + l - 1) / l;

		int sum = 0;

		if (y >= 0) {
			if (x == 0) {
				sum = xl + yl;
			} else {
				sum = xl + yl + 1;
			}
		} else {
			sum = xl + yl + 2;
		}

		System.out.println(sum);

	}

}
0