結果

問題 No.48 ロボットの操縦
ユーザー ぴろずぴろず
提出日時 2014-12-15 15:25:51
言語 Java21
(openjdk 21)
結果
AC  
実行時間 138 ms / 5,000 ms
コード長 508 bytes
コンパイル時間 2,136 ms
コンパイル使用メモリ 74,124 KB
実行使用メモリ 41,692 KB
最終ジャッジ日時 2024-05-01 13:32:07
合計ジャッジ時間 6,390 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
41,032 KB
testcase_01 AC 130 ms
41,264 KB
testcase_02 AC 130 ms
41,200 KB
testcase_03 AC 121 ms
40,048 KB
testcase_04 AC 128 ms
41,344 KB
testcase_05 AC 130 ms
41,572 KB
testcase_06 AC 129 ms
41,016 KB
testcase_07 AC 121 ms
39,908 KB
testcase_08 AC 133 ms
41,116 KB
testcase_09 AC 132 ms
41,692 KB
testcase_10 AC 134 ms
40,948 KB
testcase_11 AC 130 ms
40,976 KB
testcase_12 AC 131 ms
41,208 KB
testcase_13 AC 130 ms
41,180 KB
testcase_14 AC 130 ms
41,292 KB
testcase_15 AC 129 ms
41,376 KB
testcase_16 AC 120 ms
40,060 KB
testcase_17 AC 116 ms
41,540 KB
testcase_18 AC 130 ms
41,316 KB
testcase_19 AC 129 ms
41,188 KB
testcase_20 AC 131 ms
41,452 KB
testcase_21 AC 138 ms
41,584 KB
testcase_22 AC 131 ms
41,176 KB
testcase_23 AC 129 ms
41,032 KB
testcase_24 AC 132 ms
41,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package no048;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long x = sc.nextInt();
		long y = sc.nextInt();
		long l = sc.nextInt();
		long ans = 0;
		if (y >= 0) {
			if (x != 0) {
				ans += 1;
			}
		}else{
			ans += 2;
		}
		if (Math.abs(x) > 0) {
			ans += (Math.abs(x) - 1) / l + 1;
		}
		if (Math.abs(y) > 0) {
			ans += (Math.abs(y) - 1) / l + 1;
		}
		System.out.println(ans);
	}

}
0