結果
問題 | No.48 ロボットの操縦 |
ユーザー |
|
提出日時 | 2021-01-05 23:54:16 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 59 ms / 5,000 ms |
コード長 | 639 bytes |
コンパイル時間 | 2,210 ms |
コンパイル使用メモリ | 74,812 KB |
実行使用メモリ | 50,328 KB |
最終ジャッジ日時 | 2024-11-06 08:39:46 |
合計ジャッジ時間 | 4,604 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int x = Integer.parseInt(br.readLine()); int y = Integer.parseInt(br.readLine()); int l = Integer.parseInt(br.readLine()); int xl = (Math.abs(x) + l - 1) / l; int yl = (Math.abs(y) + l - 1) / l; int sum = 0; if (y >= 0) { if (x == 0) { sum = xl + yl; } else { sum = xl + yl + 1; } } else { sum = xl + yl + 2; } System.out.println(sum); } }