結果
問題 |
No.48 ロボットの操縦
|
ユーザー |
|
提出日時 | 2017-10-26 23:02:12 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 626 bytes |
コンパイル時間 | 3,131 ms |
コンパイル使用メモリ | 74,292 KB |
実行使用メモリ | 41,360 KB |
最終ジャッジ日時 | 2024-11-21 20:13:52 |
合計ジャッジ時間 | 7,218 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 WA * 15 |
ソースコード
import java.text.DecimalFormat; import java.util.Scanner; public class No48 { public static void main(String[] args) { Scanner s = new Scanner(System.in); int x = s.nextInt(); int y = s.nextInt(); int l = s.nextInt(); int turn = 0; turn += x != 0 && y < 0 ? 1 : 0; turn += x == 0 && y < 0 ? 2 : 0; turn += x != 0 && y != 0 ? 1 : 0; x = Math.abs(x); y = Math.abs(y); String steps = new DecimalFormat("") .format(Math.ceil((double) x / l) + Math.ceil((double) y / l) + turn); System.out.println(steps); } }