結果
| 問題 |
No.172 UFOを捕まえろ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-04-06 04:11:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 403 bytes |
| コンパイル時間 | 475 ms |
| コンパイル使用メモリ | 57,972 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-15 15:08:10 |
| 合計ジャッジ時間 | 1,264 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int x, y, r;
cin >> x >> y >> r;
// double dis = sqrt(x*x + y*y) + r;
int b;
if ((x >= 0 && y >= 0) || (x <= 0 && y <= 0)) {
// y = -x +b <=>
b = y + x;
} else {
// y = x +b <=>
b = y - x;
}
cout << static_cast<int>(sqrt(2) * r) + abs(b) + 1 << endl;
return 0;
}