結果

問題 No.48 ロボットの操縦
ユーザー TatsuDX
提出日時 2016-09-08 23:35:57
言語 Java
(openjdk 23)
結果
AC  
実行時間 120 ms / 5,000 ms
コード長 468 bytes
コンパイル時間 2,920 ms
コンパイル使用メモリ 74,348 KB
実行使用メモリ 48,224 KB
最終ジャッジ日時 2024-11-21 18:54:24
合計ジャッジ時間 6,584 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt(), y = sc.nextInt(), t = sc.nextInt(), cnt = 0;
		if (x < 0) {
			x *= -1;
		}
		if (x > 0) {
			cnt++;
		}
		if (y < 0) {
			y *= -1;
			if (x > 0) {
				cnt++;
			} else {
				cnt += 2;
			}
		}
		cnt += x / t + y / t;
		if (x % t > 0) {
			cnt++;
		}
		if (y % t > 0) {
			cnt++;
		}
		System.out.println(cnt);
	}
}
0