結果

問題 No.48 ロボットの操縦
ユーザー 37zigen37zigen
提出日時 2016-03-10 00:38:16
言語 Java21
(openjdk 21)
結果
AC  
実行時間 112 ms / 5,000 ms
コード長 363 bytes
コンパイル時間 1,657 ms
コンパイル使用メモリ 70,844 KB
実行使用メモリ 56,412 KB
最終ジャッジ日時 2023-08-14 00:23:50
合計ジャッジ時間 5,230 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
55,732 KB
testcase_01 AC 105 ms
55,924 KB
testcase_02 AC 100 ms
55,980 KB
testcase_03 AC 104 ms
55,744 KB
testcase_04 AC 99 ms
56,412 KB
testcase_05 AC 103 ms
55,628 KB
testcase_06 AC 102 ms
56,088 KB
testcase_07 AC 103 ms
55,696 KB
testcase_08 AC 102 ms
56,380 KB
testcase_09 AC 101 ms
55,816 KB
testcase_10 AC 104 ms
56,136 KB
testcase_11 AC 100 ms
56,052 KB
testcase_12 AC 104 ms
56,184 KB
testcase_13 AC 105 ms
55,408 KB
testcase_14 AC 101 ms
55,924 KB
testcase_15 AC 103 ms
56,092 KB
testcase_16 AC 101 ms
55,784 KB
testcase_17 AC 107 ms
56,144 KB
testcase_18 AC 105 ms
55,720 KB
testcase_19 AC 100 ms
55,944 KB
testcase_20 AC 107 ms
55,340 KB
testcase_21 AC 104 ms
55,864 KB
testcase_22 AC 100 ms
55,860 KB
testcase_23 AC 97 ms
55,628 KB
testcase_24 AC 112 ms
56,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int x=sc.nextInt();
		int y=sc.nextInt();
		int l=sc.nextInt();

		int ans=0;
		
		ans+=(Math.abs(x)+l-1)/l;
		ans+=(Math.abs(y)+l-1)/l;
		if(y>=0&&x!=0){
			ans++;
		}else if(y<0){
			ans++;
			ans++;
		}
		System.out.println(ans);
	}
}
0