結果

問題 No.172 UFOを捕まえろ
ユーザー beetbeet
提出日時 2018-07-23 17:44:33
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 47 ms / 5,000 ms
コード長 439 bytes
コンパイル時間 1,454 ms
コンパイル使用メモリ 164,052 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-28 15:38:06
合計ジャッジ時間 2,796 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 12 ms
4,380 KB
testcase_03 AC 12 ms
4,380 KB
testcase_04 AC 12 ms
4,376 KB
testcase_05 AC 16 ms
4,376 KB
testcase_06 AC 17 ms
4,376 KB
testcase_07 AC 16 ms
4,376 KB
testcase_08 AC 15 ms
4,380 KB
testcase_09 AC 16 ms
4,376 KB
testcase_10 AC 29 ms
4,376 KB
testcase_11 AC 12 ms
4,376 KB
testcase_12 AC 14 ms
4,376 KB
testcase_13 AC 9 ms
4,380 KB
testcase_14 AC 29 ms
4,376 KB
testcase_15 AC 18 ms
4,380 KB
testcase_16 AC 18 ms
4,376 KB
testcase_17 AC 16 ms
4,376 KB
testcase_18 AC 17 ms
4,380 KB
testcase_19 AC 15 ms
4,380 KB
testcase_20 AC 8 ms
4,376 KB
testcase_21 AC 47 ms
4,380 KB
testcase_22 AC 26 ms
4,380 KB
testcase_23 AC 15 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
Int x,y,r;
Int in(Int a,Int b){
  a=abs(a-x);b=abs(b-y);
  return a*a+b*b<=r*r;
}
Int check(Int a){
  for(Int i=-300;i<=300;i++)
    for(Int j=-300;j<=300;j++)
      if(in(i,j)&&abs(i)+abs(j)>=a) return 0;
  return 1;
}
signed main(){
  cin>>x>>y>>r;
  for(Int a=1;;a++){
    if(check(a)){
      cout<<a<<endl;
      return 0;
    }
  }
  return 0;
}
0