結果

問題 No.48 ロボットの操縦
ユーザー fkwnw3_1243
提出日時 2017-04-23 21:48:17
言語 Java
(openjdk 23)
結果
AC  
実行時間 50 ms / 5,000 ms
コード長 819 bytes
コンパイル時間 1,806 ms
コンパイル使用メモリ 74,748 KB
実行使用メモリ 50,384 KB
最終ジャッジ日時 2024-07-22 10:10:03
合計ジャッジ時間 4,014 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int X = Integer.parseInt(reader.readLine());
        int Y = Integer.parseInt(reader.readLine());
        int L = Integer.parseInt(reader.readLine());

        int minimumCommandCounter = 0;
        if(X!=0) {
            minimumCommandCounter = 1;
        }

        if (Y < 0) {
            minimumCommandCounter = 2;
        }
        
        X = Math.abs(X);
        Y = Math.abs(Y);
        minimumCommandCounter += (X + L - 1) / L;
        minimumCommandCounter += (Y + L - 1) / L;
        System.out.println(minimumCommandCounter);
    }
}
0