結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
56,204 KB
testcase_01 AC 120 ms
55,472 KB
testcase_02 WA -
testcase_03 AC 121 ms
55,660 KB
testcase_04 AC 120 ms
55,972 KB
testcase_05 AC 120 ms
56,240 KB
testcase_06 AC 119 ms
55,788 KB
testcase_07 AC 120 ms
56,016 KB
testcase_08 AC 120 ms
55,664 KB
testcase_09 AC 120 ms
55,892 KB
testcase_10 AC 122 ms
55,644 KB
testcase_11 AC 124 ms
55,468 KB
testcase_12 AC 119 ms
55,768 KB
testcase_13 AC 118 ms
55,648 KB
testcase_14 AC 119 ms
55,760 KB
testcase_15 AC 119 ms
55,636 KB
testcase_16 AC 118 ms
55,892 KB
testcase_17 AC 119 ms
55,748 KB
testcase_18 AC 121 ms
57,612 KB
testcase_19 AC 122 ms
55,844 KB
testcase_20 AC 118 ms
55,760 KB
testcase_21 AC 119 ms
55,640 KB
testcase_22 AC 119 ms
55,664 KB
testcase_23 AC 119 ms
55,656 KB
testcase_24 AC 121 ms
55,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long X = scan.nextLong();
		long Y = scan.nextLong();
		long L = scan.nextLong();
		scan.close();
		long 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