結果

問題 No.48 ロボットの操縦
ユーザー kohaku_kohaku
提出日時 2016-11-13 22:18:27
言語 Java
(openjdk 23)
結果
AC  
実行時間 118 ms / 5,000 ms
コード長 752 bytes
コンパイル時間 1,812 ms
コンパイル使用メモリ 74,148 KB
実行使用メモリ 41,244 KB
最終ジャッジ日時 2024-11-25 22:01:45
合計ジャッジ時間 5,153 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

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