結果

問題 No.48 ロボットの操縦
ユーザー takutakutakutaku
提出日時 2020-10-06 16:08:58
言語 Java19
(openjdk 21)
結果
WA  
実行時間 -
コード長 983 bytes
コンパイル時間 2,772 ms
コンパイル使用メモリ 71,460 KB
実行使用メモリ 56,640 KB
最終ジャッジ日時 2023-09-27 07:58:58
合計ジャッジ時間 5,858 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
55,688 KB
testcase_01 AC 110 ms
56,292 KB
testcase_02 AC 105 ms
55,740 KB
testcase_03 WA -
testcase_04 AC 102 ms
56,016 KB
testcase_05 AC 103 ms
55,904 KB
testcase_06 WA -
testcase_07 AC 107 ms
56,228 KB
testcase_08 WA -
testcase_09 AC 106 ms
56,244 KB
testcase_10 WA -
testcase_11 AC 107 ms
55,976 KB
testcase_12 AC 103 ms
55,628 KB
testcase_13 AC 103 ms
55,952 KB
testcase_14 AC 106 ms
56,164 KB
testcase_15 AC 104 ms
55,424 KB
testcase_16 AC 105 ms
55,952 KB
testcase_17 AC 107 ms
55,872 KB
testcase_18 WA -
testcase_19 AC 103 ms
55,776 KB
testcase_20 AC 107 ms
55,756 KB
testcase_21 AC 108 ms
55,688 KB
testcase_22 AC 108 ms
55,944 KB
testcase_23 AC 114 ms
56,168 KB
testcase_24 AC 109 ms
56,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        
        Scanner sc = new Scanner(System.in);
        int x = Integer.parseInt(sc.nextLine());
        int y = Integer.parseInt(sc.nextLine());
        int l = Integer.parseInt(sc.nextLine());
        
        int count = 0;
        int dis = 0;
        // 向きの変更回数
        if(y > 0 && x != 0) {
            count++;
        }else if(y < 0) {
            count += 2;
        }
        
        if(y % l != 0) {
            dis = y / l + 1;
            count += dis;
        }else {
            dis = y / l;
            count += dis;
            
        }
        
        if(x < 0) {
            x = -x;
        }
        
        if(x % l != 0) {
            dis = x / l + 1;
           count += dis;
        }else {
            dis = x / l;
            count += dis;
        }
        
        System.out.println(count);
    }
}
0