結果

問題 No.48 ロボットの操縦
ユーザー mits58mits58
提出日時 2016-07-02 20:30:08
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 432 bytes
コンパイル時間 2,239 ms
コンパイル使用メモリ 73,936 KB
実行使用メモリ 56,132 KB
最終ジャッジ日時 2024-04-20 06:10:50
合計ジャッジ時間 6,655 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
40,072 KB
testcase_01 AC 131 ms
41,196 KB
testcase_02 WA -
testcase_03 AC 110 ms
41,236 KB
testcase_04 AC 116 ms
41,368 KB
testcase_05 AC 116 ms
41,468 KB
testcase_06 AC 105 ms
41,296 KB
testcase_07 AC 117 ms
41,080 KB
testcase_08 AC 107 ms
41,292 KB
testcase_09 AC 141 ms
41,676 KB
testcase_10 AC 134 ms
41,212 KB
testcase_11 AC 134 ms
41,368 KB
testcase_12 AC 124 ms
41,240 KB
testcase_13 AC 115 ms
41,164 KB
testcase_14 AC 105 ms
41,496 KB
testcase_15 AC 106 ms
41,100 KB
testcase_16 AC 117 ms
41,172 KB
testcase_17 AC 111 ms
41,084 KB
testcase_18 AC 108 ms
41,060 KB
testcase_19 AC 143 ms
41,488 KB
testcase_20 AC 143 ms
41,464 KB
testcase_21 AC 130 ms
41,776 KB
testcase_22 AC 138 ms
41,484 KB
testcase_23 AC 122 ms
41,336 KB
testcase_24 AC 116 ms
41,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

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