結果

問題 No.48 ロボットの操縦
ユーザー nCk_cvnCk_cv
提出日時 2016-02-01 20:45:31
言語 Java21
(openjdk 21)
結果
AC  
実行時間 134 ms / 5,000 ms
コード長 463 bytes
コンパイル時間 2,297 ms
コンパイル使用メモリ 74,584 KB
実行使用メモリ 41,672 KB
最終ジャッジ日時 2024-05-01 13:48:52
合計ジャッジ時間 6,438 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
41,196 KB
testcase_01 AC 131 ms
41,328 KB
testcase_02 AC 129 ms
41,404 KB
testcase_03 AC 130 ms
41,452 KB
testcase_04 AC 127 ms
40,728 KB
testcase_05 AC 129 ms
41,544 KB
testcase_06 AC 128 ms
41,424 KB
testcase_07 AC 127 ms
41,280 KB
testcase_08 AC 129 ms
41,100 KB
testcase_09 AC 126 ms
41,100 KB
testcase_10 AC 129 ms
41,204 KB
testcase_11 AC 128 ms
41,488 KB
testcase_12 AC 131 ms
41,192 KB
testcase_13 AC 125 ms
41,328 KB
testcase_14 AC 129 ms
41,176 KB
testcase_15 AC 129 ms
41,160 KB
testcase_16 AC 129 ms
41,616 KB
testcase_17 AC 132 ms
41,024 KB
testcase_18 AC 129 ms
41,168 KB
testcase_19 AC 130 ms
41,160 KB
testcase_20 AC 128 ms
41,672 KB
testcase_21 AC 134 ms
41,072 KB
testcase_22 AC 128 ms
41,344 KB
testcase_23 AC 120 ms
39,952 KB
testcase_24 AC 128 ms
41,296 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