結果

問題 No.48 ロボットの操縦
ユーザー ryosuke0825ryosuke0825
提出日時 2018-04-09 23:07:30
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 549 bytes
コンパイル時間 2,765 ms
コンパイル使用メモリ 72,548 KB
実行使用メモリ 58,164 KB
最終ジャッジ日時 2023-09-09 03:41:19
合計ジャッジ時間 6,601 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
56,164 KB
testcase_01 AC 124 ms
56,180 KB
testcase_02 WA -
testcase_03 AC 121 ms
55,824 KB
testcase_04 WA -
testcase_05 AC 118 ms
56,108 KB
testcase_06 AC 120 ms
56,020 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 121 ms
55,992 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 122 ms
56,168 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 123 ms
56,012 KB
testcase_17 AC 122 ms
55,984 KB
testcase_18 AC 122 ms
56,108 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 122 ms
56,028 KB
testcase_23 AC 121 ms
56,904 KB
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class No48 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int Y = sc.nextInt();
		int L = sc.nextInt();

		int changeInDirection = 0;
		if (X > 0 || X < 0) {
			changeInDirection++;
			if (Y < 0) {
				changeInDirection++;
			}
		} else if (Y < 0) {
			changeInDirection++;
		}

		changeInDirection += (Math.abs(X) + Math.abs(Y)) / L;
		if (!((Math.abs(X) + Math.abs(Y)) % L == 0)) {
			changeInDirection++;
		}
		System.out.println(changeInDirection);
	}

}
0