結果
| 問題 |
No.48 ロボットの操縦
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-10-06 16:17:04 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,048 bytes |
| コンパイル時間 | 2,816 ms |
| コンパイル使用メモリ | 74,020 KB |
| 実行使用メモリ | 41,548 KB |
| 最終ジャッジ日時 | 2024-07-20 02:06:30 |
| 合計ジャッジ時間 | 6,426 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 WA * 1 |
ソースコード
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);
}
}