結果
問題 |
No.48 ロボットの操縦
|
ユーザー |
|
提出日時 | 2020-10-06 16:28:50 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 122 ms / 5,000 ms |
コード長 | 1,059 bytes |
コンパイル時間 | 1,804 ms |
コンパイル使用メモリ | 74,392 KB |
実行使用メモリ | 41,420 KB |
最終ジャッジ日時 | 2024-07-20 02:06:46 |
合計ジャッジ時間 | 5,422 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) throws Exception { // Your code here! Scanner sc = new Scanner(System.in); long x = Integer.parseInt(sc.nextLine()); long y = Integer.parseInt(sc.nextLine()); long l = Integer.parseInt(sc.nextLine()); long count = 0; long dis = 0; // 向きの変更回数 if(y >= 0 && x != 0 ) { count++; }else if(y < 0) { count += 2; } if(y < 0) { y = -y; } if(y % l != 0) { dis = y / l + 1; count += dis; }else { dis = y / l; count += dis; } if(x < 0) { x = -x; } if(x % l != 0) { dis = x / l + 1; count += dis; }else { dis = x / l; count += dis; } System.out.println(count); } }