結果

問題 No.48 ロボットの操縦
ユーザー YamaKasaYamaKasa
提出日時 2018-04-21 16:43:39
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 471 bytes
コンパイル時間 2,154 ms
コンパイル使用メモリ 71,424 KB
実行使用メモリ 57,480 KB
最終ジャッジ日時 2023-09-09 12:19:43
合計ジャッジ時間 6,912 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,868 KB
testcase_01 AC 124 ms
55,732 KB
testcase_02 WA -
testcase_03 AC 125 ms
55,628 KB
testcase_04 AC 126 ms
55,448 KB
testcase_05 AC 124 ms
55,608 KB
testcase_06 AC 124 ms
55,724 KB
testcase_07 AC 121 ms
55,752 KB
testcase_08 AC 122 ms
55,744 KB
testcase_09 AC 127 ms
55,676 KB
testcase_10 AC 124 ms
55,752 KB
testcase_11 AC 126 ms
55,808 KB
testcase_12 AC 126 ms
55,752 KB
testcase_13 AC 124 ms
55,792 KB
testcase_14 AC 124 ms
55,644 KB
testcase_15 AC 125 ms
55,664 KB
testcase_16 AC 126 ms
55,944 KB
testcase_17 AC 126 ms
55,636 KB
testcase_18 AC 126 ms
55,800 KB
testcase_19 AC 132 ms
55,872 KB
testcase_20 AC 126 ms
55,448 KB
testcase_21 AC 126 ms
55,852 KB
testcase_22 AC 126 ms
55,972 KB
testcase_23 AC 127 ms
55,692 KB
testcase_24 AC 127 ms
55,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int X = scan.nextInt();
		int Y = scan.nextInt();
		int L = scan.nextInt();
		scan.close();
		int ans = 0;
		if(Y < 0) {
			ans = 1;
			Y = - Y;
		}
		if(X != 0) {
			ans += 1;
			if(X < 0) {
				X = - X;
			}
		}
		ans += X / L + Y / L;
		if(X % L > 0) {
			ans += 1;
		}
		if(Y % L > 0) {
			ans += 1;
		}
		System.out.println(ans);
	}
}
0