結果

問題 No.48 ロボットの操縦
ユーザー koukonkokoukonko
提出日時 2015-12-07 16:58:16
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 782 bytes
コンパイル時間 1,913 ms
コンパイル使用メモリ 71,060 KB
実行使用メモリ 49,804 KB
最終ジャッジ日時 2023-10-12 20:03:57
合計ジャッジ時間 4,161 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,108 KB
testcase_01 AC 44 ms
49,176 KB
testcase_02 AC 43 ms
49,276 KB
testcase_03 AC 43 ms
49,292 KB
testcase_04 AC 43 ms
49,208 KB
testcase_05 WA -
testcase_06 AC 43 ms
49,208 KB
testcase_07 AC 43 ms
49,368 KB
testcase_08 AC 44 ms
49,428 KB
testcase_09 AC 43 ms
49,212 KB
testcase_10 AC 43 ms
49,244 KB
testcase_11 AC 44 ms
49,804 KB
testcase_12 AC 44 ms
49,268 KB
testcase_13 AC 44 ms
49,468 KB
testcase_14 AC 43 ms
49,288 KB
testcase_15 AC 43 ms
49,300 KB
testcase_16 AC 43 ms
49,344 KB
testcase_17 AC 44 ms
49,200 KB
testcase_18 AC 44 ms
47,688 KB
testcase_19 AC 43 ms
49,204 KB
testcase_20 AC 44 ms
49,240 KB
testcase_21 AC 43 ms
49,188 KB
testcase_22 AC 44 ms
49,312 KB
testcase_23 AC 44 ms
49,276 KB
testcase_24 AC 43 ms
47,216 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{
				++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