結果

問題 No.48 ロボットの操縦
ユーザー sasakkisasakki
提出日時 2016-05-30 20:22:26
言語 Java21
(openjdk 21)
結果
AC  
実行時間 134 ms / 5,000 ms
コード長 450 bytes
コンパイル時間 2,391 ms
コンパイル使用メモリ 74,520 KB
実行使用メモリ 41,708 KB
最終ジャッジ日時 2024-05-01 13:56:55
合計ジャッジ時間 6,252 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
41,304 KB
testcase_01 AC 127 ms
41,404 KB
testcase_02 AC 121 ms
41,132 KB
testcase_03 AC 125 ms
41,532 KB
testcase_04 AC 123 ms
41,604 KB
testcase_05 AC 124 ms
41,420 KB
testcase_06 AC 123 ms
41,380 KB
testcase_07 AC 125 ms
41,148 KB
testcase_08 AC 116 ms
39,972 KB
testcase_09 AC 132 ms
41,344 KB
testcase_10 AC 131 ms
41,268 KB
testcase_11 AC 126 ms
41,248 KB
testcase_12 AC 127 ms
41,316 KB
testcase_13 AC 130 ms
41,444 KB
testcase_14 AC 129 ms
40,816 KB
testcase_15 AC 131 ms
41,212 KB
testcase_16 AC 126 ms
41,388 KB
testcase_17 AC 131 ms
40,988 KB
testcase_18 AC 134 ms
41,320 KB
testcase_19 AC 126 ms
41,436 KB
testcase_20 AC 125 ms
41,524 KB
testcase_21 AC 125 ms
41,708 KB
testcase_22 AC 129 ms
41,532 KB
testcase_23 AC 123 ms
41,540 KB
testcase_24 AC 125 ms
41,508 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