結果

問題 No.48 ロボットの操縦
ユーザー jp_stejp_ste
提出日時 2016-05-14 23:12:34
言語 Java21
(openjdk 21)
結果
AC  
実行時間 119 ms / 5,000 ms
コード長 644 bytes
コンパイル時間 3,629 ms
コンパイル使用メモリ 75,296 KB
実行使用メモリ 54,320 KB
最終ジャッジ日時 2024-05-01 13:54:27
合計ジャッジ時間 6,518 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
53,832 KB
testcase_01 AC 105 ms
52,840 KB
testcase_02 AC 114 ms
54,112 KB
testcase_03 AC 101 ms
52,868 KB
testcase_04 AC 116 ms
54,220 KB
testcase_05 AC 108 ms
53,800 KB
testcase_06 AC 111 ms
54,084 KB
testcase_07 AC 102 ms
53,592 KB
testcase_08 AC 109 ms
53,852 KB
testcase_09 AC 100 ms
52,932 KB
testcase_10 AC 111 ms
53,872 KB
testcase_11 AC 106 ms
53,960 KB
testcase_12 AC 106 ms
53,828 KB
testcase_13 AC 99 ms
52,836 KB
testcase_14 AC 107 ms
53,888 KB
testcase_15 AC 102 ms
52,992 KB
testcase_16 AC 107 ms
54,088 KB
testcase_17 AC 105 ms
53,104 KB
testcase_18 AC 116 ms
54,320 KB
testcase_19 AC 101 ms
52,628 KB
testcase_20 AC 99 ms
52,916 KB
testcase_21 AC 108 ms
53,716 KB
testcase_22 AC 111 ms
53,920 KB
testcase_23 AC 111 ms
54,116 KB
testcase_24 AC 112 ms
54,040 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main2 {
    public static void main(String[] args) {
        try (Scanner scan = new Scanner(System.in)) {
            int x = Integer.parseInt(scan.next());
            int y = Integer.parseInt(scan.next());
            int l = Integer.parseInt(scan.next());
            int count = 0;
            
            if(y < 0) count+=2;
            else if(y >= 0 && x != 0) count++;              
              
            count += (Math.abs(y)/l) + (Math.abs(y)%l>0? 1:0);
            count += (Math.abs(x)/l) + (Math.abs(x)%l>0? 1:0);
            
            System.out.println(count);
         }
    }
}
0