結果

問題 No.48 ロボットの操縦
ユーザー TatsuDXTatsuDX
提出日時 2016-09-08 23:35:57
言語 Java21
(openjdk 21)
結果
AC  
実行時間 136 ms / 5,000 ms
コード長 468 bytes
コンパイル時間 2,863 ms
コンパイル使用メモリ 74,356 KB
実行使用メモリ 41,844 KB
最終ジャッジ日時 2024-05-01 14:06:42
合計ジャッジ時間 6,463 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
41,492 KB
testcase_01 AC 112 ms
41,468 KB
testcase_02 AC 110 ms
41,272 KB
testcase_03 AC 120 ms
41,500 KB
testcase_04 AC 106 ms
41,324 KB
testcase_05 AC 109 ms
41,120 KB
testcase_06 AC 110 ms
41,104 KB
testcase_07 AC 104 ms
41,460 KB
testcase_08 AC 122 ms
41,244 KB
testcase_09 AC 111 ms
41,704 KB
testcase_10 AC 111 ms
41,544 KB
testcase_11 AC 105 ms
41,584 KB
testcase_12 AC 104 ms
41,600 KB
testcase_13 AC 104 ms
41,248 KB
testcase_14 AC 110 ms
41,628 KB
testcase_15 AC 112 ms
41,072 KB
testcase_16 AC 113 ms
41,532 KB
testcase_17 AC 116 ms
40,344 KB
testcase_18 AC 112 ms
41,420 KB
testcase_19 AC 106 ms
41,844 KB
testcase_20 AC 113 ms
41,248 KB
testcase_21 AC 123 ms
41,584 KB
testcase_22 AC 105 ms
40,152 KB
testcase_23 AC 105 ms
41,344 KB
testcase_24 AC 136 ms
41,408 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