結果
| 問題 | 
                            No.172 UFOを捕まえろ
                             | 
                    
| コンテスト | |
| ユーザー | 
                             hadrori
                         | 
                    
| 提出日時 | 2015-07-25 22:32:59 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 626 bytes | 
| コンパイル時間 | 1,646 ms | 
| コンパイル使用メモリ | 157,012 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-08 13:52:28 | 
| 合計ジャッジ時間 | 1,978 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 18 WA * 3 | 
コンパイルメッセージ
main.cpp: In function ‘void input()’:
main.cpp:27:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   27 |     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)
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;
}
            
            
            
        
            
hadrori