結果
問題 | No.48 ロボットの操縦 |
ユーザー |
|
提出日時 | 2022-05-15 20:34:41 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 54 ms / 5,000 ms |
コード長 | 1,020 bytes |
コンパイル時間 | 5,331 ms |
コンパイル使用メモリ | 78,756 KB |
実行使用メモリ | 50,332 KB |
最終ジャッジ日時 | 2024-09-13 07:01:02 |
合計ジャッジ時間 | 6,311 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
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;}}