結果

問題 No.48 ロボットの操縦
ユーザー omi_UTomi_UT
提出日時 2017-03-10 21:34:48
言語 Java
(openjdk 23)
結果
AC  
実行時間 137 ms / 5,000 ms
コード長 449 bytes
コンパイル時間 2,028 ms
コンパイル使用メモリ 74,864 KB
実行使用メモリ 56,028 KB
最終ジャッジ日時 2024-06-24 07:55:18
合計ジャッジ時間 6,286 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.IOException;
import java.util.Scanner;

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

		int ans = Math.abs(x/l) + Math.abs(y/l) + 1;
		if (x % l != 0) ans += 1;
		if (y % l != 0) ans += 1;

		if (y < 0){
			ans += 1;
		}else if (x == 0){
			ans -= 1;
		}

		System.out.println(ans);
	}
}
0