結果

問題 No.48 ロボットの操縦
ユーザー mits58mits58
提出日時 2016-07-02 20:31:27
言語 Java21
(openjdk 21)
結果
AC  
実行時間 142 ms / 5,000 ms
コード長 464 bytes
コンパイル時間 2,186 ms
コンパイル使用メモリ 74,720 KB
実行使用メモリ 41,812 KB
最終ジャッジ日時 2024-05-01 13:57:59
合計ジャッジ時間 6,324 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
41,316 KB
testcase_01 AC 128 ms
41,640 KB
testcase_02 AC 128 ms
41,032 KB
testcase_03 AC 128 ms
41,248 KB
testcase_04 AC 128 ms
41,100 KB
testcase_05 AC 131 ms
41,768 KB
testcase_06 AC 114 ms
41,572 KB
testcase_07 AC 142 ms
41,452 KB
testcase_08 AC 140 ms
41,368 KB
testcase_09 AC 123 ms
40,360 KB
testcase_10 AC 132 ms
41,712 KB
testcase_11 AC 131 ms
41,248 KB
testcase_12 AC 130 ms
41,480 KB
testcase_13 AC 127 ms
41,556 KB
testcase_14 AC 128 ms
41,812 KB
testcase_15 AC 131 ms
41,504 KB
testcase_16 AC 130 ms
41,620 KB
testcase_17 AC 133 ms
41,468 KB
testcase_18 AC 132 ms
41,600 KB
testcase_19 AC 134 ms
41,512 KB
testcase_20 AC 133 ms
41,256 KB
testcase_21 AC 134 ms
41,232 KB
testcase_22 AC 141 ms
41,256 KB
testcase_23 AC 134 ms
41,464 KB
testcase_24 AC 136 ms
41,248 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++;
			else if(x==0 && y<0) ans+=2;
			System.out.println(ans);
		}
	}
}
0