結果
| 問題 |
No.48 ロボットの操縦
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-01-07 17:19:48 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 585 bytes |
| コンパイル時間 | 4,283 ms |
| コンパイル使用メモリ | 75,880 KB |
| 実行使用メモリ | 41,540 KB |
| 最終ジャッジ日時 | 2024-12-23 10:10:12 |
| 合計ジャッジ時間 | 8,802 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 WA * 2 |
ソースコード
import java.util.Scanner;
public class No0048 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int X = sc.nextInt();
int Y = sc.nextInt();
int L = sc.nextInt();
System.out.println(turnCount(X, Y) + aheadCount(X, Y, L));
}
static int turnCount(int x, int y) {
if (y > 0) {
if (x == 0) {
return 0;
}
return 1;
} else {
return 2;
}
}
static int aheadCount(int x, int y, int l) {
int cnt = (Math.abs(x) / l) + (Math.abs(y) / l);
if (x % l != 0) {
cnt++;
}
if (y % l != 0) {
cnt++;
}
return cnt;
}
}