結果

問題 No.48 ロボットの操縦
ユーザー matsuyoshi30matsuyoshi30
提出日時 2016-02-05 17:59:46
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 5,000 ms
コード長 428 bytes
コンパイル時間 1,839 ms
コンパイル使用メモリ 71,108 KB
実行使用メモリ 56,212 KB
最終ジャッジ日時 2023-08-14 00:21:51
合計ジャッジ時間 6,016 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
56,048 KB
testcase_01 AC 122 ms
56,016 KB
testcase_02 AC 122 ms
56,212 KB
testcase_03 AC 121 ms
56,016 KB
testcase_04 AC 123 ms
56,000 KB
testcase_05 AC 122 ms
56,176 KB
testcase_06 AC 123 ms
56,188 KB
testcase_07 AC 124 ms
55,816 KB
testcase_08 AC 124 ms
55,804 KB
testcase_09 AC 123 ms
55,992 KB
testcase_10 AC 123 ms
55,616 KB
testcase_11 AC 123 ms
56,192 KB
testcase_12 AC 124 ms
55,976 KB
testcase_13 AC 123 ms
55,988 KB
testcase_14 AC 126 ms
55,832 KB
testcase_15 AC 124 ms
56,132 KB
testcase_16 AC 123 ms
55,860 KB
testcase_17 AC 124 ms
55,696 KB
testcase_18 AC 124 ms
55,860 KB
testcase_19 AC 124 ms
55,900 KB
testcase_20 AC 124 ms
55,916 KB
testcase_21 AC 125 ms
55,716 KB
testcase_22 AC 123 ms
55,404 KB
testcase_23 AC 124 ms
55,556 KB
testcase_24 AC 125 ms
55,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Test {
	public static void main(String[] args) throws Exception {
		Scanner in = new Scanner(System.in);
		int x = in.nextInt();
		int y = in.nextInt();
		int l = in.nextInt();

		int ans = 0;
		if((x != 0) && (y >= 0)) {
			ans++;
		} else if(y < 0) {
			ans += 2;
		}

		x = Math.abs(x);
		y = Math.abs(y);

		ans += (x + l - 1) / l;
		ans += (y + l - 1) / l;

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