結果

問題 No.48 ロボットの操縦
ユーザー YukimotoPGYukimotoPG
提出日時 2019-02-14 23:29:12
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 534 bytes
コンパイル時間 1,930 ms
コンパイル使用メモリ 71,384 KB
実行使用メモリ 56,496 KB
最終ジャッジ日時 2023-10-11 12:48:15
合計ジャッジ時間 6,044 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
56,156 KB
testcase_01 AC 121 ms
56,084 KB
testcase_02 WA -
testcase_03 AC 119 ms
55,344 KB
testcase_04 AC 120 ms
55,616 KB
testcase_05 AC 120 ms
55,688 KB
testcase_06 AC 119 ms
55,908 KB
testcase_07 AC 121 ms
55,312 KB
testcase_08 AC 122 ms
54,004 KB
testcase_09 AC 121 ms
55,596 KB
testcase_10 AC 121 ms
55,940 KB
testcase_11 AC 122 ms
55,840 KB
testcase_12 AC 120 ms
55,804 KB
testcase_13 AC 120 ms
56,068 KB
testcase_14 AC 121 ms
56,060 KB
testcase_15 AC 120 ms
55,804 KB
testcase_16 AC 123 ms
56,284 KB
testcase_17 AC 122 ms
56,192 KB
testcase_18 AC 122 ms
55,784 KB
testcase_19 AC 121 ms
55,636 KB
testcase_20 AC 122 ms
55,848 KB
testcase_21 AC 125 ms
54,424 KB
testcase_22 AC 121 ms
55,944 KB
testcase_23 AC 124 ms
55,716 KB
testcase_24 AC 126 ms
55,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		
		int x = sc.nextInt(); int y = sc.nextInt(); int L = sc.nextInt();
		
		int ans = 0;
		
		if (y>=0 && x!=0) ans += 1;
		else if (y<0 && x!=0) ans += 2;
		
//		System.out.println(":"+ans);
		
		if (x%L == 0) ans += Math.abs(x/L);
		else ans += Math.abs(x/L) + 1;
		
//		System.out.println(":"+ans);
		
		if (y%L == 0) ans += Math.abs(y/L);
		else ans += Math.abs(y/L) + 1;
		
		System.out.println(ans);
		
	}
}
0