結果

問題 No.48 ロボットの操縦
ユーザー HaleakalaHaleakala
提出日時 2018-02-24 17:05:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 124 ms / 5,000 ms
コード長 587 bytes
コンパイル時間 3,361 ms
コンパイル使用メモリ 74,656 KB
実行使用メモリ 41,860 KB
最終ジャッジ日時 2024-04-22 15:55:47
合計ジャッジ時間 7,244 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
41,148 KB
testcase_01 AC 120 ms
41,356 KB
testcase_02 AC 106 ms
41,412 KB
testcase_03 AC 119 ms
41,324 KB
testcase_04 AC 117 ms
41,408 KB
testcase_05 AC 122 ms
41,512 KB
testcase_06 AC 112 ms
41,160 KB
testcase_07 AC 118 ms
41,372 KB
testcase_08 AC 120 ms
41,352 KB
testcase_09 AC 115 ms
41,376 KB
testcase_10 AC 120 ms
41,860 KB
testcase_11 AC 120 ms
41,380 KB
testcase_12 AC 106 ms
41,248 KB
testcase_13 AC 123 ms
41,408 KB
testcase_14 AC 115 ms
41,540 KB
testcase_15 AC 109 ms
41,052 KB
testcase_16 AC 123 ms
41,320 KB
testcase_17 AC 123 ms
41,524 KB
testcase_18 AC 123 ms
41,108 KB
testcase_19 AC 118 ms
41,212 KB
testcase_20 AC 124 ms
41,388 KB
testcase_21 AC 124 ms
41,264 KB
testcase_22 AC 111 ms
41,260 KB
testcase_23 AC 122 ms
41,364 KB
testcase_24 AC 116 ms
41,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Answer {
	public static void main(String str[]) {
        Scanner sc = new Scanner(System.in);
        double x = Double.valueOf(sc.nextLine());
        double y = Double.valueOf(sc.nextLine());
        double l = Double.valueOf(sc.nextLine());

        int operationNum = 0;
        if(y<0) {
        	operationNum += 2;
        } else if(x != 0) {
        	operationNum += 1;
        }

        operationNum += (int) Math.ceil(Math.abs(x/l));
        operationNum += (int) Math.ceil(Math.abs(y/l));
        System.out.println(operationNum);
	}
}
0