結果

問題 No.48 ロボットの操縦
ユーザー soujikisoujiki
提出日時 2015-04-27 15:45:32
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 847 bytes
コンパイル時間 4,599 ms
コンパイル使用メモリ 73,808 KB
実行使用メモリ 57,604 KB
最終ジャッジ日時 2023-09-18 13:52:21
合計ジャッジ時間 9,197 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
55,436 KB
testcase_01 AC 129 ms
57,604 KB
testcase_02 AC 129 ms
55,520 KB
testcase_03 WA -
testcase_04 AC 130 ms
55,768 KB
testcase_05 AC 129 ms
56,032 KB
testcase_06 AC 130 ms
55,576 KB
testcase_07 AC 129 ms
55,480 KB
testcase_08 AC 126 ms
55,520 KB
testcase_09 AC 128 ms
55,612 KB
testcase_10 AC 129 ms
55,560 KB
testcase_11 AC 128 ms
55,392 KB
testcase_12 AC 130 ms
55,520 KB
testcase_13 AC 126 ms
55,568 KB
testcase_14 AC 127 ms
55,456 KB
testcase_15 AC 127 ms
55,516 KB
testcase_16 AC 127 ms
55,688 KB
testcase_17 AC 128 ms
55,924 KB
testcase_18 AC 131 ms
55,512 KB
testcase_19 AC 130 ms
55,540 KB
testcase_20 AC 129 ms
55,500 KB
testcase_21 AC 128 ms
55,672 KB
testcase_22 AC 131 ms
55,640 KB
testcase_23 AC 130 ms
55,532 KB
testcase_24 AC 127 ms
55,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

	
import java.util.*;

public class Yukicoder_48{
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int X = stdIn.nextInt();
		int Y = stdIn.nextInt();
		int L = stdIn.nextInt();
		int count = 0;

		if(X==0 && Y==0){
			System.out.println("0");
		}
		else{
			if(X>0){
			count++;
			int x = X/L;
			count += x;
			X = X - x*L;
			if(X!=0){
				count++;
			}

			}
			else if(X<0){
				count++;
				X = (-1)*X;
				int x = X/L;
				count += x;
				X = X - x*L;
				if(X!=0){
					count++;
				}
			}

			if(Y>0){
				int y = Y/L;
				count += y;
				Y = Y - y*L;
				if(Y!=0){
					count++;
				}
			}
			else if(Y<0){
				if(X==0){
					count++;
				}
				count++;
				Y = (-1)*Y;
				int y = Y/L;
				count += y;
				Y = Y - y*L;
				if(Y!=0){
					count++;
				}
			}

			System.out.println(count);

		}

	}
}
0