結果

問題 No.48 ロボットの操縦
ユーザー Flere0114
提出日時 2016-02-10 17:48:10
言語 Java
(openjdk 23)
結果
AC  
実行時間 127 ms / 5,000 ms
コード長 516 bytes
コンパイル時間 3,335 ms
コンパイル使用メモリ 74,956 KB
実行使用メモリ 41,468 KB
最終ジャッジ日時 2024-11-21 18:34:50
合計ジャッジ時間 7,165 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No48 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int Y = sc.nextInt();
        int L = sc.nextInt();
        int ans = 0;

        ans += (Math.abs(Y) + L - 1) / L;
        ans += (Math.abs(X) + L - 1) / L;
        if(X != 0){
            ans++;
        }else if(Y < 0){
            ans++;
        }
        if(Y < 0){
            ans++;
        }

        System.out.println(ans);
    }
}
0