結果

問題 No.48 ロボットの操縦
ユーザー abc
提出日時 2016-10-25 12:56:51
言語 Java
(openjdk 23)
結果
AC  
実行時間 132 ms / 5,000 ms
コード長 620 bytes
コンパイル時間 1,921 ms
コンパイル使用メモリ 74,664 KB
実行使用メモリ 41,812 KB
最終ジャッジ日時 2024-11-24 03:33:27
合計ジャッジ時間 6,008 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int x = sc.nextInt();
        int y = sc.nextInt();

        int distancePerOpe = sc.nextInt();

        int operationCount = 0;

        if (x != 0) {
            operationCount = 1;
        }

        if (y < 0) {
            operationCount = 2;
        }

        operationCount += (Math.abs(x) + distancePerOpe - 1) / distancePerOpe;
        operationCount += (Math.abs(y) + distancePerOpe - 1) / distancePerOpe;

        System.out.println(operationCount);

    }

}
0