結果

問題 No.48 ロボットの操縦
ユーザー 37zigen
提出日時 2016-03-10 00:38:16
言語 Java
(openjdk 23)
結果
AC  
実行時間 124 ms / 5,000 ms
コード長 363 bytes
コンパイル時間 1,934 ms
コンパイル使用メモリ 73,592 KB
実行使用メモリ 41,364 KB
最終ジャッジ日時 2024-11-21 18:35:47
合計ジャッジ時間 5,882 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int x=sc.nextInt();
		int y=sc.nextInt();
		int l=sc.nextInt();

		int ans=0;
		
		ans+=(Math.abs(x)+l-1)/l;
		ans+=(Math.abs(y)+l-1)/l;
		if(y>=0&&x!=0){
			ans++;
		}else if(y<0){
			ans++;
			ans++;
		}
		System.out.println(ans);
	}
}
0