結果

問題 No.48 ロボットの操縦
ユーザー nCk_cvnCk_cv
提出日時 2016-02-01 20:45:31
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 5,000 ms
コード長 463 bytes
コンパイル時間 3,125 ms
コンパイル使用メモリ 71,800 KB
実行使用メモリ 56,068 KB
最終ジャッジ日時 2023-08-14 00:21:41
合計ジャッジ時間 6,899 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,700 KB
testcase_01 AC 127 ms
55,736 KB
testcase_02 AC 122 ms
55,892 KB
testcase_03 AC 121 ms
56,056 KB
testcase_04 AC 121 ms
55,852 KB
testcase_05 AC 124 ms
55,712 KB
testcase_06 AC 124 ms
55,660 KB
testcase_07 AC 126 ms
55,680 KB
testcase_08 AC 123 ms
55,460 KB
testcase_09 AC 122 ms
55,812 KB
testcase_10 AC 123 ms
55,620 KB
testcase_11 AC 124 ms
55,980 KB
testcase_12 AC 122 ms
55,860 KB
testcase_13 AC 123 ms
56,052 KB
testcase_14 AC 123 ms
55,816 KB
testcase_15 AC 123 ms
55,808 KB
testcase_16 AC 124 ms
55,568 KB
testcase_17 AC 122 ms
55,968 KB
testcase_18 AC 121 ms
55,768 KB
testcase_19 AC 122 ms
56,048 KB
testcase_20 AC 123 ms
55,996 KB
testcase_21 AC 121 ms
55,536 KB
testcase_22 AC 122 ms
56,048 KB
testcase_23 AC 123 ms
56,068 KB
testcase_24 AC 122 ms
55,956 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.math.*;
import java.io.*;
 
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;
		if(y >= 0 && x != 0) ans += 1;
		else if(y < 0 || x != 0) ans += 2;
		ans += Math.abs((y / l)) + (y % l != 0 && y != 0?1:0);
		ans += Math.abs((x / l)) + (x % l != 0 && x != 0?1:0);
		System.out.println(ans);
	}
}
0