結果

問題 No.48 ロボットの操縦
ユーザー ryosuke0825
提出日時 2018-04-09 23:07:30
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 549 bytes
コンパイル時間 2,093 ms
コンパイル使用メモリ 74,388 KB
実行使用メモリ 56,252 KB
最終ジャッジ日時 2024-06-26 20:50:01
合計ジャッジ時間 6,440 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12 WA * 13
権限があれば一括ダウンロードができます

ソースコード

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