結果

問題 No.48 ロボットの操縦
ユーザー kou6839kou6839
提出日時 2014-11-19 13:30:44
言語 Java21
(openjdk 21)
結果
AC  
実行時間 130 ms / 5,000 ms
コード長 533 bytes
コンパイル時間 2,452 ms
コンパイル使用メモリ 71,408 KB
実行使用メモリ 56,556 KB
最終ジャッジ日時 2023-08-13 23:55:41
合計ジャッジ時間 6,465 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
56,104 KB
testcase_01 AC 119 ms
55,516 KB
testcase_02 AC 119 ms
55,736 KB
testcase_03 AC 117 ms
56,272 KB
testcase_04 AC 114 ms
55,724 KB
testcase_05 AC 127 ms
56,048 KB
testcase_06 AC 116 ms
55,992 KB
testcase_07 AC 116 ms
56,088 KB
testcase_08 AC 117 ms
56,000 KB
testcase_09 AC 118 ms
55,996 KB
testcase_10 AC 116 ms
55,988 KB
testcase_11 AC 118 ms
56,100 KB
testcase_12 AC 119 ms
56,064 KB
testcase_13 AC 115 ms
55,912 KB
testcase_14 AC 118 ms
56,556 KB
testcase_15 AC 114 ms
55,676 KB
testcase_16 AC 113 ms
54,008 KB
testcase_17 AC 117 ms
55,756 KB
testcase_18 AC 117 ms
56,204 KB
testcase_19 AC 118 ms
56,248 KB
testcase_20 AC 125 ms
55,592 KB
testcase_21 AC 121 ms
55,796 KB
testcase_22 AC 130 ms
56,016 KB
testcase_23 AC 127 ms
56,124 KB
testcase_24 AC 122 ms
56,196 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
 

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