結果

問題 No.48 ロボットの操縦
ユーザー k_kadora
提出日時 2015-05-21 10:51:29
言語 Java
(openjdk 23)
結果
AC  
実行時間 132 ms / 5,000 ms
コード長 563 bytes
コンパイル時間 3,806 ms
コンパイル使用メモリ 74,332 KB
実行使用メモリ 41,736 KB
最終ジャッジ日時 2024-11-21 18:20:28
合計ジャッジ時間 7,095 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Robot{
	public static void main(String[] arg){
		int x,y,l,res=0;
		Scanner sc = new Scanner(System.in);
		x = sc.nextInt();
		y = sc.nextInt();
		l = sc.nextInt();
		if(y>= 0 && x != 0){
			res++;
		}else if(y<0){
			res = res+2;
		}
		if((x != 0) && (Math.abs(x)%l == 0)){
			res = res + (Math.abs(x)/l);
		}else if (x != 0){
			res = res + (Math.abs(x)/l)+1;
		}
		if((y != 0) && (Math.abs(y) % l == 0)){
			res = res + (Math.abs(y)/l);
		}else if (y != 0){
			res = res + (Math.abs(y)/l)+1;
		}
		System.out.println(res);
	}
}
0