結果

問題 No.48 ロボットの操縦
ユーザー sasakkisasakki
提出日時 2016-05-30 20:15:14
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 430 bytes
コンパイル時間 2,234 ms
コンパイル使用メモリ 74,552 KB
実行使用メモリ 41,584 KB
最終ジャッジ日時 2024-04-16 18:46:54
合計ジャッジ時間 6,347 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
41,100 KB
testcase_01 AC 129 ms
41,164 KB
testcase_02 AC 129 ms
41,264 KB
testcase_03 WA -
testcase_04 AC 130 ms
41,232 KB
testcase_05 AC 130 ms
41,176 KB
testcase_06 AC 129 ms
41,216 KB
testcase_07 AC 128 ms
41,572 KB
testcase_08 WA -
testcase_09 AC 130 ms
41,124 KB
testcase_10 WA -
testcase_11 AC 129 ms
41,264 KB
testcase_12 AC 128 ms
41,184 KB
testcase_13 AC 129 ms
41,344 KB
testcase_14 AC 131 ms
41,176 KB
testcase_15 AC 128 ms
41,156 KB
testcase_16 AC 129 ms
41,528 KB
testcase_17 AC 128 ms
41,284 KB
testcase_18 WA -
testcase_19 AC 129 ms
41,012 KB
testcase_20 AC 133 ms
41,400 KB
testcase_21 AC 132 ms
41,268 KB
testcase_22 WA -
testcase_23 AC 126 ms
40,540 KB
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int X = Integer.parseInt(sc.next());
		int Y = Integer.parseInt(sc.next());
		int L = Integer.parseInt(sc.next());

		int ans = (Math.abs(X)+L-1)/L + (Math.abs(Y)+L-1)/L;

		if(Y>=0){
			if(X!=0){
				ans++;
					}
		}
		else{
			ans = ans + 2;
			if(X!=0){
				ans++;
			}
		}
				
		System.out.println(ans);
	}
}
0