結果

問題 No.48 ロボットの操縦
ユーザー kou6839
提出日時 2014-11-19 13:30:44
言語 Java
(openjdk 23)
結果
AC  
実行時間 155 ms / 5,000 ms
コード長 533 bytes
コンパイル時間 2,824 ms
コンパイル使用メモリ 74,080 KB
実行使用メモリ 42,332 KB
最終ジャッジ日時 2024-11-21 18:08:02
合計ジャッジ時間 7,377 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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();
		double l=sc.nextDouble();
		int ans=0;
		if(x==0&&y==0){
			System.out.println(0);
			return;
		}
		if(y>=0){
			ans+=(int)Math.ceil(y/l);
			if(x!=0){
				ans+=1+(int)Math.ceil(Math.abs(x)/l);
			}
		}else{
			ans=(int)Math.ceil(Math.abs(y)/l);
			
				ans+=2+(int)Math.ceil(Math.abs(x)/l);
			
		}
		System.out.println(ans);
	}
}	
0