結果

問題 No.48 ロボットの操縦
ユーザー kohaku_kohaku
提出日時 2016-11-09 21:41:49
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 694 bytes
コンパイル時間 1,898 ms
コンパイル使用メモリ 73,988 KB
実行使用メモリ 54,140 KB
最終ジャッジ日時 2024-11-25 06:03:10
合計ジャッジ時間 5,582 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 1
権限があれば一括ダウンロードができます

ソースコード

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(X!=0){
                turn=1;
        }
        if(Y<0){
                turn=turn+1;
        }

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