結果

問題 No.48 ロボットの操縦
ユーザー TatsuDXTatsuDX
提出日時 2016-09-08 23:35:57
言語 Java19
(openjdk 21)
結果
AC  
実行時間 108 ms / 5,000 ms
コード長 468 bytes
コンパイル時間 3,546 ms
コンパイル使用メモリ 72,128 KB
実行使用メモリ 56,152 KB
最終ジャッジ日時 2023-08-14 00:56:45
合計ジャッジ時間 7,150 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 103 ms
56,064 KB
testcase_01 AC 105 ms
55,808 KB
testcase_02 AC 104 ms
55,196 KB
testcase_03 AC 105 ms
55,704 KB
testcase_04 AC 106 ms
56,012 KB
testcase_05 AC 106 ms
55,272 KB
testcase_06 AC 108 ms
55,468 KB
testcase_07 AC 105 ms
55,732 KB
testcase_08 AC 106 ms
56,152 KB
testcase_09 AC 103 ms
55,464 KB
testcase_10 AC 103 ms
56,136 KB
testcase_11 AC 106 ms
55,548 KB
testcase_12 AC 104 ms
55,968 KB
testcase_13 AC 106 ms
56,052 KB
testcase_14 AC 103 ms
55,536 KB
testcase_15 AC 102 ms
55,464 KB
testcase_16 AC 101 ms
55,776 KB
testcase_17 AC 106 ms
55,912 KB
testcase_18 AC 103 ms
55,972 KB
testcase_19 AC 105 ms
55,828 KB
testcase_20 AC 102 ms
56,020 KB
testcase_21 AC 102 ms
56,012 KB
testcase_22 AC 102 ms
55,584 KB
testcase_23 AC 103 ms
55,648 KB
testcase_24 AC 103 ms
55,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt(), y = sc.nextInt(), t = sc.nextInt(), cnt = 0;
		if (x < 0) {
			x *= -1;
		}
		if (x > 0) {
			cnt++;
		}
		if (y < 0) {
			y *= -1;
			if (x > 0) {
				cnt++;
			} else {
				cnt += 2;
			}
		}
		cnt += x / t + y / t;
		if (x % t > 0) {
			cnt++;
		}
		if (y % t > 0) {
			cnt++;
		}
		System.out.println(cnt);
	}
}
0