結果
| 問題 |
No.48 ロボットの操縦
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-03-27 14:52:30 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 826 bytes |
| コンパイル時間 | 709 ms |
| コンパイル使用メモリ | 58,628 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-02 04:34:34 |
| 合計ジャッジ時間 | 1,375 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 WA * 1 |
ソースコード
#include <iostream>
#include <cmath>
using namespace std;
int walkCount(int a, int b) {
if ((a % b) == 0) {
return (static_cast<int>(abs(a)) / b);
} else {
return (static_cast<int>(abs(a)) / b + 1);
}
}
int main() {
int x, y, l;
cin >> x >> y >> l;
int ans = 0;
if (y == 0) {
ans = walkCount(x, l);
ans++;
} else if (0 < y) {
if (x == 0) {
ans = walkCount(y, l);
} else if (x != 0) {
ans = walkCount(y, l) + walkCount(x, l);
ans++;
}
} else if (y < 0) {
if (x == 0) {
ans = walkCount(y, l);
ans += 2;
} else if (x != 0) {
ans = walkCount(y, l) + walkCount(x, l);
ans += 2;
}
}
cout << ans <<endl;
return 0;
}