結果
| 問題 |
No.172 UFOを捕まえろ
|
| コンテスト | |
| ユーザー |
hadrori
|
| 提出日時 | 2015-07-25 18:38:54 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 581 bytes |
| コンパイル時間 | 1,261 ms |
| コンパイル使用メモリ | 156,976 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-08 13:49:02 |
| 合計ジャッジ時間 | 2,058 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 WA * 3 |
コンパイルメッセージ
main.cpp: In function ‘void input()’:
main.cpp:26:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
26 | scanf("%d%d%d", &x, &y, &r);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repi(i,0,n)
int x, y, r;
bool ok(int m) {
const double u = 1.*(m+x-y)/2-x, v = -1.*(m+x-y)/2+m-y;
return r*r < u*u+v*v;
}
int solve() {
if(x < 0) x *= -1;
if(y < 0) y *= -1;
int lb = x+y, ub = 256, m;
while(ub-lb > 1) {
m = (lb+ub)/2;
if(ok(m)) ub = m;
else lb = m;
}
return ub;
}
void input() {
scanf("%d%d%d", &x, &y, &r);
}
int main() {
input();
printf("%d\n", solve());
return 0;
}
hadrori