結果

問題 No.48 ロボットの操縦
ユーザー shinshin
提出日時 2022-05-15 20:25:14
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 968 bytes
コンパイル時間 3,349 ms
コンパイル使用メモリ 75,908 KB
実行使用メモリ 49,908 KB
最終ジャッジ日時 2023-10-11 07:46:41
合計ジャッジ時間 5,646 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
49,452 KB
testcase_01 AC 40 ms
49,324 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 41 ms
49,432 KB
testcase_05 AC 41 ms
49,356 KB
testcase_06 WA -
testcase_07 AC 41 ms
49,208 KB
testcase_08 WA -
testcase_09 AC 40 ms
49,300 KB
testcase_10 WA -
testcase_11 AC 41 ms
49,292 KB
testcase_12 AC 41 ms
49,656 KB
testcase_13 AC 41 ms
49,192 KB
testcase_14 AC 42 ms
49,204 KB
testcase_15 AC 40 ms
49,784 KB
testcase_16 AC 40 ms
49,472 KB
testcase_17 AC 41 ms
49,152 KB
testcase_18 WA -
testcase_19 AC 40 ms
49,376 KB
testcase_20 AC 41 ms
49,336 KB
testcase_21 AC 40 ms
49,232 KB
testcase_22 WA -
testcase_23 AC 41 ms
49,328 KB
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class No48 {

	public static void main(String[] args) throws IOException {
		//ロボットの操縦
		String[] text = readStr();
		Long X = Math.abs(Long.parseLong(text[0])) , Y = Math.abs(Long.parseLong(text[1])) , L = Long.parseLong(text[2]);
		
		Long count = Math.floorDiv(X, L) + Math.floorDiv(Y , L);
		if(Math.floorMod(X, L) > 0) {
			count += 1;
		}
		if(Math.floorMod(Y, L) > 0) {
			count += 1;
		}
		if(X != 0 && Y != 0) {
			count += 1;
		}
		
		System.out.println(count);

	}
	
	public static String[] readStr() throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<String> list = new ArrayList<>();
		
		do {
			list.add(br.readLine());
		}while(br.ready());
		
		br.close();
		
		String[] text = new String[list.size()];
		list.toArray(text);
		
		return text;
		
	}

}
0