結果

問題 No.48 ロボットの操縦
ユーザー NoNo
提出日時 2017-08-01 21:21:03
言語 Java21
(openjdk 21)
結果
AC  
実行時間 150 ms / 5,000 ms
コード長 410 bytes
コンパイル時間 2,062 ms
コンパイル使用メモリ 74,684 KB
実行使用メモリ 54,612 KB
最終ジャッジ日時 2024-04-19 07:38:52
合計ジャッジ時間 6,560 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 141 ms
54,612 KB
testcase_01 AC 142 ms
54,036 KB
testcase_02 AC 145 ms
54,336 KB
testcase_03 AC 143 ms
54,148 KB
testcase_04 AC 139 ms
54,480 KB
testcase_05 AC 143 ms
53,876 KB
testcase_06 AC 142 ms
54,520 KB
testcase_07 AC 142 ms
54,448 KB
testcase_08 AC 142 ms
54,276 KB
testcase_09 AC 143 ms
54,076 KB
testcase_10 AC 140 ms
54,336 KB
testcase_11 AC 142 ms
54,156 KB
testcase_12 AC 150 ms
54,432 KB
testcase_13 AC 140 ms
54,336 KB
testcase_14 AC 141 ms
54,348 KB
testcase_15 AC 141 ms
54,396 KB
testcase_16 AC 131 ms
53,736 KB
testcase_17 AC 141 ms
54,208 KB
testcase_18 AC 138 ms
54,216 KB
testcase_19 AC 139 ms
54,300 KB
testcase_20 AC 127 ms
53,456 KB
testcase_21 AC 145 ms
54,132 KB
testcase_22 AC 147 ms
54,004 KB
testcase_23 AC 138 ms
54,176 KB
testcase_24 AC 141 ms
54,104 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