結果

問題 No.48 ロボットの操縦
ユーザー shinshin
提出日時 2022-05-15 20:29:43
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,008 bytes
コンパイル時間 5,847 ms
コンパイル使用メモリ 76,040 KB
実行使用メモリ 49,668 KB
最終ジャッジ日時 2023-10-11 07:53:22
合計ジャッジ時間 5,928 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
49,332 KB
testcase_01 AC 42 ms
49,656 KB
testcase_02 AC 42 ms
49,276 KB
testcase_03 WA -
testcase_04 AC 42 ms
49,472 KB
testcase_05 AC 42 ms
49,228 KB
testcase_06 AC 42 ms
49,452 KB
testcase_07 AC 43 ms
49,668 KB
testcase_08 WA -
testcase_09 AC 43 ms
49,236 KB
testcase_10 WA -
testcase_11 AC 44 ms
49,332 KB
testcase_12 AC 43 ms
49,244 KB
testcase_13 AC 44 ms
49,356 KB
testcase_14 AC 44 ms
49,304 KB
testcase_15 AC 44 ms
49,300 KB
testcase_16 AC 44 ms
49,520 KB
testcase_17 AC 43 ms
49,464 KB
testcase_18 WA -
testcase_19 AC 44 ms
49,440 KB
testcase_20 AC 43 ms
49,548 KB
testcase_21 AC 43 ms
49,224 KB
testcase_22 WA -
testcase_23 AC 43 ms
49,508 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 = 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