結果

問題 No.48 ロボットの操縦
ユーザー koukonkokoukonko
提出日時 2015-12-07 17:00:04
言語 Java21
(openjdk 21)
結果
AC  
実行時間 54 ms / 5,000 ms
コード長 793 bytes
コンパイル時間 2,255 ms
コンパイル使用メモリ 73,636 KB
実行使用メモリ 37,288 KB
最終ジャッジ日時 2024-05-01 13:46:17
合計ジャッジ時間 4,110 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
37,288 KB
testcase_01 AC 53 ms
36,824 KB
testcase_02 AC 52 ms
37,152 KB
testcase_03 AC 53 ms
37,096 KB
testcase_04 AC 54 ms
37,040 KB
testcase_05 AC 52 ms
36,976 KB
testcase_06 AC 52 ms
37,120 KB
testcase_07 AC 52 ms
37,040 KB
testcase_08 AC 52 ms
37,104 KB
testcase_09 AC 52 ms
37,076 KB
testcase_10 AC 52 ms
37,040 KB
testcase_11 AC 52 ms
36,612 KB
testcase_12 AC 53 ms
36,816 KB
testcase_13 AC 54 ms
36,880 KB
testcase_14 AC 52 ms
37,076 KB
testcase_15 AC 53 ms
36,940 KB
testcase_16 AC 52 ms
36,984 KB
testcase_17 AC 53 ms
36,776 KB
testcase_18 AC 52 ms
37,092 KB
testcase_19 AC 52 ms
36,648 KB
testcase_20 AC 52 ms
36,632 KB
testcase_21 AC 52 ms
37,036 KB
testcase_22 AC 52 ms
36,908 KB
testcase_23 AC 52 ms
36,868 KB
testcase_24 AC 52 ms
36,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));

		try {
			int X = Integer.parseInt(buff.readLine());
			int Y = Integer.parseInt(buff.readLine());
			int L = Integer.parseInt(buff.readLine());

			int ans = 0;
			if(Y > 0){
				if(X != 0){
					++ans;
				}
			}else if(Y < 0){
				ans += 2;
			}else if(X != 0){
				++ans;
			}

			if(X < 0){
				X *= -1;
			}
			if(Y < 0){
				Y *= -1;
			}

			ans += X / L;
			if(X % L > 0){
				ans++;
			}
			ans += Y / L;
			if(Y % L > 0){
				ans++;
			}

			System.out.println(ans);

		} catch (NumberFormatException e) {

		} catch (IOException e) {

		}
	}
}
0