結果

問題 No.172 UFOを捕まえろ
ユーザー nmnmnmnmnmnmnm
提出日時 2015-03-27 00:00:49
言語 C++11
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 1,490 bytes
コンパイル時間 661 ms
コンパイル使用メモリ 86,548 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-29 01:10:52
合計ジャッジ時間 1,452 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(long long i=(a);i<(b);++i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define MOD 1000000007
int x,y,r;
int f1(int ax, int ay, int bx, int by, int cx, int cy){
int x1 = (bx-ax);
int y1 = (by-ay);
int x2 = (cx-ax);
int y2 = (cy-ay);
return x1 * y2 - y1 * x2;
}
void abc(int x1, int y1, int x2, int y2, int &a, int &b, int &c){
a = y2 - y1;
b = x1 - x2;
c = x2 * y1 - x1 * y2;
}
int distpl(int x, int y, int a, int b, int c){
return abs(a * x + b * y + c);
}
int f(int p){
int d[4][4] ={
{-p,0,0,p},
{0,p,p,0},
{p,0,0,-p},
{0,-p,-p,0}
};
int flag = 1;
rep(i,0,4){
if(f1(d[i][0],d[i][1],d[i][2],d[i][3],x,y)>0)flag=0;
int a,b,c;
abc(d[i][0],d[i][1],d[i][2],d[i][3],a,b,c);
int l = distpl(x,y,a,b,c);
if(l*l<=r*r*(a*a+b*b)){
flag = 0;
}
}
return flag;
}
int main(){
cin>>x>>y>>r;
rep(i,1,10000){
if(f(i)==1){
cout << i << endl;
break;
}
}
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0