結果

問題 No.48 ロボットの操縦
ユーザー mits58
提出日時 2016-07-02 20:31:27
言語 Java
(openjdk 23)
結果
AC  
実行時間 139 ms / 5,000 ms
コード長 464 bytes
コンパイル時間 2,424 ms
コンパイル使用メモリ 78,288 KB
実行使用メモリ 41,796 KB
最終ジャッジ日時 2024-11-21 18:44:07
合計ジャッジ時間 6,190 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()){
			int x=sc.nextInt();
			int y=sc.nextInt();
			int l=sc.nextInt();
			int ans=0;
			if(x!=0) ans+=(Math.abs(x)+l-1)/l;
			if(y!=0) ans+=(Math.abs(y)+l-1)/l;
			if(y>0 && x!=0) ans++;
			else if(y<0 && x!=0) ans+=2;
			else if(y==0 && x!=0) ans++;
			else if(x==0 && y<0) ans+=2;
			System.out.println(ans);
		}
	}
}
0