結果

問題 No.48 ロボットの操縦
ユーザー kou6839
提出日時 2014-11-19 13:29:02
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 543 bytes
コンパイル時間 2,227 ms
コンパイル使用メモリ 76,672 KB
実行使用メモリ 54,488 KB
最終ジャッジ日時 2025-01-02 19:14:53
合計ジャッジ時間 6,713 ms
ジャッジサーバーID
(参考情報)
judge5 / 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();
		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);
			if(x!=0){
				ans+=2+(int)Math.ceil(Math.abs(x)/l);
			}
		}
		System.out.println(ans);
	}
}	
0