結果

問題 No.48 ロボットの操縦
ユーザー NoNo
提出日時 2017-08-01 21:21:03
言語 Java21
(openjdk 21)
結果
AC  
実行時間 137 ms / 5,000 ms
コード長 410 bytes
コンパイル時間 1,847 ms
コンパイル使用メモリ 70,768 KB
実行使用メモリ 58,092 KB
最終ジャッジ日時 2023-08-01 08:08:52
合計ジャッジ時間 6,354 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
55,980 KB
testcase_01 AC 135 ms
56,328 KB
testcase_02 AC 136 ms
55,764 KB
testcase_03 AC 135 ms
56,248 KB
testcase_04 AC 137 ms
56,000 KB
testcase_05 AC 137 ms
55,920 KB
testcase_06 AC 135 ms
56,156 KB
testcase_07 AC 134 ms
56,328 KB
testcase_08 AC 133 ms
56,092 KB
testcase_09 AC 132 ms
55,624 KB
testcase_10 AC 129 ms
55,784 KB
testcase_11 AC 133 ms
56,384 KB
testcase_12 AC 134 ms
56,092 KB
testcase_13 AC 133 ms
56,268 KB
testcase_14 AC 134 ms
56,240 KB
testcase_15 AC 135 ms
55,864 KB
testcase_16 AC 135 ms
56,036 KB
testcase_17 AC 134 ms
58,092 KB
testcase_18 AC 135 ms
54,108 KB
testcase_19 AC 135 ms
54,304 KB
testcase_20 AC 136 ms
55,976 KB
testcase_21 AC 134 ms
55,996 KB
testcase_22 AC 131 ms
56,116 KB
testcase_23 AC 134 ms
56,284 KB
testcase_24 AC 135 ms
55,936 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();
    	double l = sc.nextDouble();
    	int ans = (int)(Math.ceil(Math.abs(x) / l) + Math.ceil(Math.abs(y) / l));
    	int n = 0;
    	if(y < 0)n = 2;
    	if(y >= 0 && x != 0)n = 1;
    	System.out.println(ans + n);
    }
}
0