結果

問題 No.48 ロボットの操縦
ユーザー omc-testomc-test
提出日時 2016-08-22 09:19:34
言語 Java21
(openjdk 21)
結果
AC  
実行時間 44 ms / 5,000 ms
コード長 639 bytes
コンパイル時間 3,043 ms
コンパイル使用メモリ 72,664 KB
実行使用メモリ 49,668 KB
最終ジャッジ日時 2023-08-14 00:46:25
合計ジャッジ時間 5,226 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
49,188 KB
testcase_01 AC 41 ms
49,068 KB
testcase_02 AC 42 ms
49,668 KB
testcase_03 AC 42 ms
49,324 KB
testcase_04 AC 41 ms
49,068 KB
testcase_05 AC 41 ms
49,388 KB
testcase_06 AC 41 ms
49,072 KB
testcase_07 AC 41 ms
49,012 KB
testcase_08 AC 42 ms
49,012 KB
testcase_09 AC 43 ms
49,236 KB
testcase_10 AC 42 ms
49,068 KB
testcase_11 AC 42 ms
49,204 KB
testcase_12 AC 43 ms
49,204 KB
testcase_13 AC 42 ms
49,188 KB
testcase_14 AC 42 ms
49,012 KB
testcase_15 AC 42 ms
49,160 KB
testcase_16 AC 42 ms
49,104 KB
testcase_17 AC 42 ms
49,164 KB
testcase_18 AC 42 ms
49,028 KB
testcase_19 AC 40 ms
49,108 KB
testcase_20 AC 41 ms
49,112 KB
testcase_21 AC 41 ms
49,188 KB
testcase_22 AC 43 ms
49,056 KB
testcase_23 AC 44 ms
49,292 KB
testcase_24 AC 41 ms
49,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class No0048 {
	public static void main(String[] args){
		try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))){
			long x = Long.parseLong(br.readLine());
			long y = Long.parseLong(br.readLine());
			long l = Long.parseLong(br.readLine());

			long cnt = Math.abs(y) / l + Math.abs(x) / l;
			if(Math.abs(y) % l > 0) cnt++;
			if(Math.abs(x) % l > 0) cnt++;

			if(y >= 0){
				if(x != 0) cnt ++;
			}else{
				cnt += 2;
			}

			System.out.println(cnt);
		}catch(IOException e){
			e.printStackTrace();
		}
	}
}
0