結果

問題 No.48 ロボットの操縦
コンテスト
ユーザー kohaku_kohaku
提出日時 2016-11-13 22:18:27
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
AC  
実行時間 76 ms / 5,000 ms
コード長 752 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,671 ms
コンパイル使用メモリ 81,260 KB
実行使用メモリ 41,600 KB
最終ジャッジ日時 2026-05-20 11:38:53
合計ジャッジ時間 3,959 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import java.util.*;

public class Main {
    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 turn=0;
        int gox=0;
        int goy=0;

        if(X%L==0){
                gox=Math.abs(X/L);
        }else{
                gox=Math.abs(X/L)+1;
        }
        if(Y%L==0){
                goy=Math.abs(Y/L);
        }else{
                goy=Math.abs(Y/L)+1;
        }

        if(Y>=0){
            if(X==0){
                turn=0;
            }else{
                turn=1;
            }
        }else{
            turn=2;
        }

        int r = gox+goy+turn;
        System.out.println( r );
    }
}
0