結果

問題 No.48 ロボットの操縦
ユーザー scache
提出日時 2014-11-30 23:42:21
言語 Java
(openjdk 23)
結果
AC  
実行時間 126 ms / 5,000 ms
コード長 530 bytes
コンパイル時間 3,097 ms
コンパイル使用メモリ 74,244 KB
実行使用メモリ 52,276 KB
最終ジャッジ日時 2024-11-21 18:13:44
合計ジャッジ時間 7,014 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main48 {
	public static void main(String[] args) {
		Main48 p = new Main48();
	}

	public Main48() {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		int l = sc.nextInt();
		solve(x, y, l);
	}

	public void solve(int x, int y, int l) {
		int res = x!=0 ? (Math.abs(x)-1)/l + 1 : 0;
		res += y!=0 ? (Math.abs(y)-1)/l + 1 : 0;
		
		if(y<0)
			res+=2;
		else if(Math.abs(x)>0)
			res++;
		
		System.out.println(res);
	}

}
0