結果

問題 No.48 ロボットの操縦
ユーザー t8m8⛄️t8m8⛄️
提出日時 2015-04-03 03:56:26
言語 Java21
(openjdk 21)
結果
AC  
実行時間 120 ms / 5,000 ms
コード長 916 bytes
コンパイル時間 3,404 ms
コンパイル使用メモリ 75,636 KB
実行使用メモリ 54,412 KB
最終ジャッジ日時 2024-05-01 13:34:55
合計ジャッジ時間 6,527 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
53,124 KB
testcase_01 AC 118 ms
54,036 KB
testcase_02 AC 105 ms
53,056 KB
testcase_03 AC 112 ms
53,708 KB
testcase_04 AC 114 ms
53,880 KB
testcase_05 AC 110 ms
53,984 KB
testcase_06 AC 109 ms
53,432 KB
testcase_07 AC 101 ms
52,940 KB
testcase_08 AC 110 ms
53,644 KB
testcase_09 AC 111 ms
53,260 KB
testcase_10 AC 115 ms
53,856 KB
testcase_11 AC 106 ms
52,716 KB
testcase_12 AC 119 ms
54,160 KB
testcase_13 AC 120 ms
54,000 KB
testcase_14 AC 105 ms
52,692 KB
testcase_15 AC 113 ms
54,004 KB
testcase_16 AC 109 ms
53,640 KB
testcase_17 AC 114 ms
53,920 KB
testcase_18 AC 116 ms
53,956 KB
testcase_19 AC 116 ms
54,004 KB
testcase_20 AC 108 ms
54,412 KB
testcase_21 AC 116 ms
53,924 KB
testcase_22 AC 111 ms
53,104 KB
testcase_23 AC 103 ms
52,832 KB
testcase_24 AC 115 ms
54,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//No.48 ロボットの操縦

import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;

public class No48 {
    
    static final Scanner sc = new Scanner(System.in);
    static final PrintWriter out = new PrintWriter(System.out,false);

    static void solve() {
        int x = sc.nextInt();
        int y = sc.nextInt();
        int l = sc.nextInt();
        int ans = (x == 0 && y >= 0 ? 0 : (y >= 0 ? 1 : 2));
        x = abs(x); y = abs(y);
        ans += x/l + (x%l == 0 ? 0 : 1) + y/l + (y%l == 0 ? 0 : 1); 
        out.println(ans);
    }

    public static void main(String[] args) {
        long start = System.currentTimeMillis();

        solve();
        out.flush();

        long end = System.currentTimeMillis();
        //trace(end-start + "ms");
        sc.close();
    }

    static void trace(Object... o) { System.out.println(deepToString(o));}
}
0