結果
問題 | No.48 ロボットの操縦 |
ユーザー |
![]() |
提出日時 | 2017-04-23 21:45:37 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 51 ms / 5,000 ms |
コード長 | 1,279 bytes |
コンパイル時間 | 1,825 ms |
コンパイル使用メモリ | 77,524 KB |
実行使用メモリ | 37,152 KB |
最終ジャッジ日時 | 2024-07-22 10:09:45 |
合計ジャッジ時間 | 3,865 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 reader = new BufferedReader(new InputStreamReader(System.in)); int X = Integer.parseInt(reader.readLine()); int Y = Integer.parseInt(reader.readLine()); int L = Integer.parseInt(reader.readLine()); int minimumCommandCounter = 0; if (X >0 && Y > 0) { minimumCommandCounter += 1; } else if (X > 0 && Y < 0) { minimumCommandCounter+=2; } else if (X < 0 && Y > 0) { minimumCommandCounter+=1; } else if (X< 0 && Y < 0) { minimumCommandCounter+=2; } else if (X < 0 && Y == 0) { minimumCommandCounter+=1; } else if (X > 0 && Y ==0) { minimumCommandCounter+=1; } else if (X == 0 && Y > 0) { minimumCommandCounter+=0; } else if (X==0 && Y <0 ) { minimumCommandCounter+=2; } X = Math.abs(X); Y = Math.abs(Y); minimumCommandCounter += (X + L - 1) / L; minimumCommandCounter += (Y + L - 1) / L; System.out.println(minimumCommandCounter); } }