結果

問題 No.48 ロボットの操縦
ユーザー ぴろず
提出日時 2014-12-15 15:25:51
言語 Java
(openjdk 23)
結果
AC  
実行時間 136 ms / 5,000 ms
コード長 508 bytes
コンパイル時間 2,178 ms
コンパイル使用メモリ 73,828 KB
実行使用メモリ 41,612 KB
最終ジャッジ日時 2024-11-21 18:14:25
合計ジャッジ時間 6,367 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

package no048;

import java.util.Scanner;

public class Main {

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

}
0