結果

問題 No.48 ロボットの操縦
ユーザー AoiroFukurouAoiroFukurou
提出日時 2014-12-21 17:54:47
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 524 bytes
コンパイル時間 6,203 ms
コンパイル使用メモリ 71,856 KB
実行使用メモリ 57,784 KB
最終ジャッジ日時 2023-09-02 20:54:12
合計ジャッジ時間 9,225 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,420 KB
testcase_01 AC 124 ms
55,252 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 124 ms
55,676 KB
testcase_05 AC 126 ms
55,336 KB
testcase_06 AC 131 ms
55,520 KB
testcase_07 AC 123 ms
55,560 KB
testcase_08 WA -
testcase_09 AC 125 ms
55,792 KB
testcase_10 WA -
testcase_11 AC 126 ms
55,512 KB
testcase_12 AC 125 ms
55,208 KB
testcase_13 AC 126 ms
55,228 KB
testcase_14 AC 127 ms
55,944 KB
testcase_15 AC 126 ms
55,520 KB
testcase_16 AC 125 ms
55,672 KB
testcase_17 AC 123 ms
55,484 KB
testcase_18 WA -
testcase_19 AC 126 ms
55,196 KB
testcase_20 AC 124 ms
55,512 KB
testcase_21 AC 126 ms
55,452 KB
testcase_22 WA -
testcase_23 AC 124 ms
55,216 KB
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package benkyoukai;

import java.util.Scanner;


public class Robot {
public static void main(String[] args) {
	int x, y, l;
	int ans=0;
	Scanner sc = new Scanner(System.in);
	x = sc.nextInt();
	y = sc.nextInt();
	l = sc.nextInt();
	x=Math.abs(x);
	if(y==0){
		if(x==0){
			ans = 0;
		}else{
			ans = (x + l -1)/l+1;
		}
	
}
	if(y>0){
		ans = (y+l-1)/l;
		if(x!=0){
			ans +=1+(x+l-1)/l;
		}
			
		}
	if(y<0){
		ans = (y+l-1)/l;
		if(x==0){
			ans +=2;
		}else{
			ans +=(2+(x+l-1)/l);
		}
	}
	System.out.println(ans);
	}
}
0