結果

問題 No.48 ロボットの操縦
ユーザー shin
提出日時 2022-05-15 20:25:14
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 968 bytes
コンパイル時間 4,643 ms
コンパイル使用メモリ 78,696 KB
実行使用メモリ 50,492 KB
最終ジャッジ日時 2024-09-13 06:49:28
合計ジャッジ時間 6,582 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17 WA * 8
権限があれば一括ダウンロードができます

ソースコード

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