結果

問題 No.48 ロボットの操縦
ユーザー reo3313
提出日時 2015-10-03 22:26:57
言語 Java
(openjdk 23)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 731 bytes
コンパイル時間 4,031 ms
コンパイル使用メモリ 82,948 KB
実行使用メモリ 41,964 KB
最終ジャッジ日時 2024-11-21 18:27:23
合計ジャッジ時間 8,241 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

package test1;
import java.util.Scanner;
import java.util.Arrays;

public class test1_class {
    public static void main(String[] args) {
        // 標準入力から読み込む際に、Scannerオブジェクトを使う。
        Scanner sc = new Scanner(System.in);

    	int X = sc.nextInt();
    	int Y = sc.nextInt();
    	int L = sc.nextInt();
    	int ans=0;
    	
    	//向きを変える命令回数
    	if((X!=0) && (Y>=0)) {
    		ans = ans + 1;
    	}else if(Y<0){
    		ans = ans + 2;
    	}

    	X = Math.abs(X);
    	Y = Math.abs(Y);
    	    	
    	//歩く距離の命令回数
       		ans += (X+L-1)/L;   		
       		ans += (Y+L-1)/L;   		

    	System.out.println(ans + "\n");
        sc.close();
    }
}
0