結果

問題 No.48 ロボットの操縦
ユーザー shinshin
提出日時 2022-05-15 20:29:43
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 1,008 bytes
コンパイル時間 3,903 ms
コンパイル使用メモリ 78,312 KB
実行使用メモリ 50,360 KB
最終ジャッジ日時 2024-09-13 06:55:27
合計ジャッジ時間 5,976 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19 WA * 6
権限があれば一括ダウンロードができます

ソースコード

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 = Long.parseLong(text[0]) , Y = Long.parseLong(text[1]) , L = Long.parseLong(text[2]);
		
		Long count = Math.floorDiv(Math.abs(X), L) + Math.floorDiv(Math.abs(Y) , L);
		if(Math.floorMod(Math.abs(X), L) > 0) {
			count += 1;
		}
		if(Math.floorMod(Math.abs(Y), L) > 0) {
			count += 1;
		}
		if(X != 0) {
			count += 1;
		}
		if(Y < 0) {
			count += 2;
		}
		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