結果

問題 No.48 ロボットの操縦
ユーザー Daigo HIROOKADaigo HIROOKA
提出日時 2018-05-15 01:13:02
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 5,000 ms
コード長 749 bytes
コンパイル時間 3,337 ms
コンパイル使用メモリ 72,168 KB
実行使用メモリ 56,144 KB
最終ジャッジ日時 2023-09-10 20:54:26
合計ジャッジ時間 7,626 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
56,088 KB
testcase_01 AC 125 ms
55,668 KB
testcase_02 AC 125 ms
55,908 KB
testcase_03 AC 123 ms
55,788 KB
testcase_04 AC 124 ms
56,032 KB
testcase_05 AC 124 ms
55,900 KB
testcase_06 AC 127 ms
55,976 KB
testcase_07 AC 124 ms
56,004 KB
testcase_08 AC 123 ms
56,024 KB
testcase_09 AC 125 ms
55,916 KB
testcase_10 AC 125 ms
55,680 KB
testcase_11 AC 124 ms
55,600 KB
testcase_12 AC 124 ms
55,864 KB
testcase_13 AC 122 ms
56,000 KB
testcase_14 AC 125 ms
55,912 KB
testcase_15 AC 124 ms
53,952 KB
testcase_16 AC 125 ms
55,996 KB
testcase_17 AC 122 ms
53,524 KB
testcase_18 AC 123 ms
55,676 KB
testcase_19 AC 123 ms
56,008 KB
testcase_20 AC 121 ms
56,144 KB
testcase_21 AC 123 ms
55,796 KB
testcase_22 AC 124 ms
56,012 KB
testcase_23 AC 123 ms
56,040 KB
testcase_24 AC 124 ms
55,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RobotOperation{
    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 num_step = 0;
        if(X != 0 && Y >= 0){
            num_step += 1;
        }else if(Y < 0){
            num_step += 2;
        }

        if(X%L == 0){
            num_step += Math.abs(X)/L;
        }else{
            num_step += Math.abs(X)/L+1;
        }

        if(Y%L == 0){
            num_step += Math.abs(Y)/L;
        }else{
            num_step += Math.abs(Y)/L+1;
        }
        System.out.println(num_step);

    }
}
0