結果

問題 No.48 ロボットの操縦
ユーザー S1hoS1ho
提出日時 2017-02-20 18:14:47
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 688 bytes
コンパイル時間 3,268 ms
コンパイル使用メモリ 72,432 KB
実行使用メモリ 56,168 KB
最終ジャッジ日時 2023-08-28 21:34:47
合計ジャッジ時間 7,666 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
55,804 KB
testcase_01 AC 124 ms
55,764 KB
testcase_02 WA -
testcase_03 AC 125 ms
55,800 KB
testcase_04 AC 123 ms
55,744 KB
testcase_05 AC 126 ms
55,936 KB
testcase_06 AC 125 ms
55,728 KB
testcase_07 AC 127 ms
55,944 KB
testcase_08 AC 126 ms
55,700 KB
testcase_09 AC 125 ms
55,948 KB
testcase_10 AC 124 ms
55,728 KB
testcase_11 AC 127 ms
55,768 KB
testcase_12 AC 127 ms
55,992 KB
testcase_13 AC 125 ms
55,700 KB
testcase_14 AC 124 ms
55,712 KB
testcase_15 AC 125 ms
55,776 KB
testcase_16 AC 123 ms
55,892 KB
testcase_17 AC 123 ms
55,768 KB
testcase_18 AC 124 ms
55,916 KB
testcase_19 AC 127 ms
55,688 KB
testcase_20 AC 125 ms
55,780 KB
testcase_21 AC 125 ms
56,168 KB
testcase_22 AC 124 ms
55,916 KB
testcase_23 AC 125 ms
56,000 KB
testcase_24 AC 122 ms
55,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Robot2 {

    public static void main(String[] args) {
        
        Scanner scanner = new Scanner(System.in);
        
        double x = scanner.nextInt();
        double y = scanner.nextInt();
        double l = scanner.nextInt();
        
        double count = 0;
        
        //回転
        if(y<0){
            count++;
        }
        
        if(x != 0){
            count++;
        }
        
        x = Math.abs(x);
        y = Math.abs(y);
        
        //進む回数 -> 距離 / L (切り上げ)
        count += Math.ceil(x/l) + Math.ceil(y/l);
        
        System.out.println((int)count);
        
    }
    
}
0