結果

問題 No.48 ロボットの操縦
ユーザー enuo-9
提出日時 2016-09-15 15:28:08
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 597 bytes
コンパイル時間 3,639 ms
コンパイル使用メモリ 74,316 KB
実行使用メモリ 41,332 KB
最終ジャッジ日時 2024-11-17 06:04:57
合計ジャッジ時間 8,585 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No048 {
	public static void main(String args[]){
		int x = 0;
		int y = 0;
		int distance = 0;
		int go = 0;
		int turn = 0;
		Scanner sc = new Scanner(System.in);

		x = sc.nextInt();
		y = sc.nextInt();
		go = sc.nextInt();

		//回頭に要する行為判定
		if(0<y){
			turn = 1;
		}else if(y<0){
			turn = 2;
			y=y*-1;
		}else if(y==0){
			turn = 0;
		}

		while(true){
			y=y-go;
			turn++;
			if(y<=0){
				break;
			}
		}

		if(x<0){x=x*-1;}

		while(true){
			x=x-go;
			turn++;
			if(x<=0){
				break;
			}
		}

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