結果

問題 No.172 UFOを捕まえろ
コンテスト
ユーザー hadrori
提出日時 2015-07-25 22:32:59
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 626 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,034 ms
コンパイル使用メモリ 177,292 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2026-03-30 07:59:14
合計ジャッジ時間 1,780 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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)

inline int sq(int x) { return x*x; }
int x, y, r;

bool ok(int m) {
    const int cx = (m+x-y)*5, cy = -cx+m*10;
    return sq(10*r) < sq(cx-10*x)+sq(cy-10*y);
}

int solve() {
    if(x < 0) x *= -1;
    if(y < 0) y *= -1;
    int lb = x+y+r, 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;
}
0