結果

問題 No.48 ロボットの操縦
ユーザー shinshin
提出日時 2022-05-15 20:34:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 45 ms / 5,000 ms
コード長 1,020 bytes
コンパイル時間 3,593 ms
コンパイル使用メモリ 75,780 KB
実行使用メモリ 49,688 KB
最終ジャッジ日時 2023-10-11 07:59:50
合計ジャッジ時間 6,071 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,284 KB
testcase_01 AC 43 ms
49,412 KB
testcase_02 AC 44 ms
49,044 KB
testcase_03 AC 44 ms
49,136 KB
testcase_04 AC 45 ms
49,320 KB
testcase_05 AC 44 ms
49,176 KB
testcase_06 AC 44 ms
49,412 KB
testcase_07 AC 43 ms
49,496 KB
testcase_08 AC 43 ms
49,688 KB
testcase_09 AC 43 ms
49,552 KB
testcase_10 AC 43 ms
49,328 KB
testcase_11 AC 44 ms
49,180 KB
testcase_12 AC 43 ms
49,096 KB
testcase_13 AC 45 ms
49,264 KB
testcase_14 AC 43 ms
49,232 KB
testcase_15 AC 43 ms
49,604 KB
testcase_16 AC 43 ms
49,328 KB
testcase_17 AC 43 ms
49,160 KB
testcase_18 AC 43 ms
49,100 KB
testcase_19 AC 43 ms
49,240 KB
testcase_20 AC 43 ms
49,116 KB
testcase_21 AC 43 ms
49,132 KB
testcase_22 AC 43 ms
49,124 KB
testcase_23 AC 43 ms
49,140 KB
testcase_24 AC 43 ms
49,140 KB
権限があれば一括ダウンロードができます

ソースコード

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(Y >= 0 && X != 0) {
			count += 1;
		}else 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