結果

問題 No.48 ロボットの操縦
ユーザー matsuyoshi30matsuyoshi30
提出日時 2016-02-05 17:59:46
言語 Java21
(openjdk 21)
結果
AC  
実行時間 133 ms / 5,000 ms
コード長 428 bytes
コンパイル時間 2,256 ms
コンパイル使用メモリ 74,492 KB
実行使用メモリ 41,628 KB
最終ジャッジ日時 2024-05-01 13:49:01
合計ジャッジ時間 6,608 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
41,304 KB
testcase_01 AC 123 ms
41,412 KB
testcase_02 AC 125 ms
41,368 KB
testcase_03 AC 132 ms
41,164 KB
testcase_04 AC 128 ms
41,288 KB
testcase_05 AC 131 ms
41,424 KB
testcase_06 AC 120 ms
40,188 KB
testcase_07 AC 124 ms
41,544 KB
testcase_08 AC 109 ms
41,264 KB
testcase_09 AC 120 ms
40,156 KB
testcase_10 AC 117 ms
41,416 KB
testcase_11 AC 128 ms
41,080 KB
testcase_12 AC 129 ms
41,464 KB
testcase_13 AC 128 ms
41,016 KB
testcase_14 AC 128 ms
41,276 KB
testcase_15 AC 120 ms
40,984 KB
testcase_16 AC 126 ms
41,320 KB
testcase_17 AC 123 ms
41,452 KB
testcase_18 AC 123 ms
41,556 KB
testcase_19 AC 129 ms
41,392 KB
testcase_20 AC 133 ms
41,456 KB
testcase_21 AC 124 ms
41,332 KB
testcase_22 AC 126 ms
41,344 KB
testcase_23 AC 126 ms
41,108 KB
testcase_24 AC 123 ms
41,628 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