結果

問題 No.48 ロボットの操縦
ユーザー AoiroFukurouAoiroFukurou
提出日時 2014-12-21 17:55:47
言語 Java21
(openjdk 21)
結果
AC  
実行時間 116 ms / 5,000 ms
コード長 525 bytes
コンパイル時間 3,300 ms
コンパイル使用メモリ 73,576 KB
実行使用メモリ 56,288 KB
最終ジャッジ日時 2023-08-14 00:01:31
合計ジャッジ時間 6,500 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
55,436 KB
testcase_01 AC 105 ms
55,740 KB
testcase_02 AC 105 ms
55,752 KB
testcase_03 AC 111 ms
55,856 KB
testcase_04 AC 110 ms
56,216 KB
testcase_05 AC 106 ms
56,064 KB
testcase_06 AC 108 ms
55,824 KB
testcase_07 AC 109 ms
56,288 KB
testcase_08 AC 105 ms
56,068 KB
testcase_09 AC 106 ms
55,768 KB
testcase_10 AC 105 ms
56,148 KB
testcase_11 AC 105 ms
55,888 KB
testcase_12 AC 109 ms
55,820 KB
testcase_13 AC 114 ms
56,180 KB
testcase_14 AC 108 ms
56,216 KB
testcase_15 AC 106 ms
55,992 KB
testcase_16 AC 108 ms
55,820 KB
testcase_17 AC 107 ms
55,372 KB
testcase_18 AC 110 ms
56,108 KB
testcase_19 AC 116 ms
56,008 KB
testcase_20 AC 107 ms
56,036 KB
testcase_21 AC 106 ms
56,112 KB
testcase_22 AC 104 ms
55,900 KB
testcase_23 AC 103 ms
55,740 KB
testcase_24 AC 106 ms
56,244 KB
権限があれば一括ダウンロードができます

ソースコード

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