結果

問題 No.48 ロボットの操縦
ユーザー sasakkisasakki
提出日時 2016-05-30 20:18:08
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 449 bytes
コンパイル時間 2,176 ms
コンパイル使用メモリ 75,188 KB
実行使用メモリ 56,148 KB
最終ジャッジ日時 2024-04-16 18:47:05
合計ジャッジ時間 6,266 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
41,452 KB
testcase_01 AC 126 ms
41,324 KB
testcase_02 AC 127 ms
41,240 KB
testcase_03 AC 128 ms
41,408 KB
testcase_04 AC 128 ms
41,568 KB
testcase_05 AC 128 ms
41,128 KB
testcase_06 AC 129 ms
41,124 KB
testcase_07 AC 126 ms
41,288 KB
testcase_08 WA -
testcase_09 AC 128 ms
41,372 KB
testcase_10 AC 130 ms
41,656 KB
testcase_11 AC 128 ms
41,192 KB
testcase_12 AC 126 ms
41,376 KB
testcase_13 AC 128 ms
41,452 KB
testcase_14 AC 127 ms
41,212 KB
testcase_15 AC 125 ms
41,148 KB
testcase_16 AC 128 ms
41,276 KB
testcase_17 AC 127 ms
41,532 KB
testcase_18 AC 129 ms
41,524 KB
testcase_19 AC 127 ms
41,296 KB
testcase_20 AC 126 ms
41,452 KB
testcase_21 AC 126 ms
41,468 KB
testcase_22 WA -
testcase_23 AC 129 ms
41,224 KB
testcase_24 AC 126 ms
41,048 KB
権限があれば一括ダウンロードができます

ソースコード

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){
				if(X>0){
				ans++;
				}
			}
		}
				
		System.out.println(ans);
	}
}
0