結果

問題 No.48 ロボットの操縦
ユーザー YamaKasaYamaKasa
提出日時 2018-04-21 17:17:23
言語 Java19
(openjdk 21)
結果
AC  
実行時間 121 ms / 5,000 ms
コード長 549 bytes
コンパイル時間 1,851 ms
コンパイル使用メモリ 71,944 KB
実行使用メモリ 56,424 KB
最終ジャッジ日時 2023-09-09 12:20:37
合計ジャッジ時間 5,997 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,688 KB
testcase_01 AC 118 ms
56,096 KB
testcase_02 AC 120 ms
55,816 KB
testcase_03 AC 119 ms
55,916 KB
testcase_04 AC 118 ms
56,064 KB
testcase_05 AC 118 ms
55,860 KB
testcase_06 AC 118 ms
56,424 KB
testcase_07 AC 119 ms
55,856 KB
testcase_08 AC 118 ms
56,124 KB
testcase_09 AC 119 ms
55,948 KB
testcase_10 AC 119 ms
55,724 KB
testcase_11 AC 118 ms
55,656 KB
testcase_12 AC 118 ms
56,252 KB
testcase_13 AC 118 ms
55,500 KB
testcase_14 AC 118 ms
56,244 KB
testcase_15 AC 118 ms
55,456 KB
testcase_16 AC 118 ms
56,288 KB
testcase_17 AC 118 ms
55,776 KB
testcase_18 AC 119 ms
55,776 KB
testcase_19 AC 118 ms
55,664 KB
testcase_20 AC 120 ms
55,692 KB
testcase_21 AC 119 ms
56,080 KB
testcase_22 AC 121 ms
56,072 KB
testcase_23 AC 118 ms
56,064 KB
testcase_24 AC 117 ms
55,488 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(X == 0 && Y <0) {
			ans += 2;
			Y = -Y;
		}else {
			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