結果

問題 No.48 ロボットの操縦
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-13 22:18:27
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 5,000 ms
コード長 752 bytes
コンパイル時間 1,937 ms
コンパイル使用メモリ 71,360 KB
実行使用メモリ 56,396 KB
最終ジャッジ日時 2023-08-17 04:25:47
合計ジャッジ時間 6,244 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,888 KB
testcase_01 AC 124 ms
56,312 KB
testcase_02 AC 122 ms
55,664 KB
testcase_03 AC 123 ms
55,680 KB
testcase_04 AC 123 ms
56,148 KB
testcase_05 AC 123 ms
55,936 KB
testcase_06 AC 121 ms
55,796 KB
testcase_07 AC 124 ms
56,068 KB
testcase_08 AC 121 ms
56,076 KB
testcase_09 AC 124 ms
55,552 KB
testcase_10 AC 124 ms
55,932 KB
testcase_11 AC 122 ms
56,020 KB
testcase_12 AC 121 ms
56,156 KB
testcase_13 AC 124 ms
55,920 KB
testcase_14 AC 124 ms
55,952 KB
testcase_15 AC 123 ms
56,396 KB
testcase_16 AC 123 ms
56,072 KB
testcase_17 AC 124 ms
56,196 KB
testcase_18 AC 124 ms
55,812 KB
testcase_19 AC 123 ms
56,020 KB
testcase_20 AC 125 ms
55,940 KB
testcase_21 AC 123 ms
56,072 KB
testcase_22 AC 126 ms
55,740 KB
testcase_23 AC 124 ms
56,016 KB
testcase_24 AC 125 ms
55,524 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    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 turn=0;
        int gox=0;
        int goy=0;

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

        if(Y>=0){
            if(X==0){
                turn=0;
            }else{
                turn=1;
            }
        }else{
            turn=2;
        }

        int r = gox+goy+turn;
        System.out.println( r );
    }
}
0