记录编号 |
26927 |
评测结果 |
AAAAAAAAAA |
题目名称 |
打蚊子 |
最终得分 |
100 |
用户昵称 |
PurpleShadow |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
1.991 s |
提交时间 |
2011-07-29 17:18:10 |
内存使用 |
0.29 MiB |
显示代码纯文本
#include <cstdio>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
const int N=2010;
const double pi=acos(-1.0);
int n,R;
struct node
{
double r;
int o;
bool operator<(const node &t)const
{return r<t.r;}
node(const double &_r,const int &_o):r(_r),o(_o){}
};
struct point
{double x,y;} p[N];
vector<node> A;
inline double dis(const point &a,const point &b)
{return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));}
inline double GetAngle(const point &a,const point &b)
{
double ki=atan2(b.x-a.x,b.y-a.y);
return ki<0?2*pi+ki:ki;
}
void solve()
{
int i,j,sum,ans=1;
double dist,thi,delta;
for (i=1;i<=n;++i)
{
A.clear();
for (j=1;j<=n;++j)
{
if (i==j) continue;
if ((dist=dis(p[i],p[j]))>2*R) continue;
thi=GetAngle(p[i],p[j]);
delta=acos(dist/2/R);
A.push_back(node(thi-delta,1));
A.push_back(node(thi+delta,-1));
}
if (A.size()<ans*2) continue;
sort(A.begin(),A.end());
sum=1;
for (vector<node>::iterator vt=A.begin();vt!=A.end();++vt)
{
sum+=vt->o;
if (sum>ans) ans=sum;
}
}
printf("%d\n",ans);
}
int main()
{
freopen("fight.in","r",stdin);
freopen("fight.out","w",stdout);
scanf("%d%d",&n,&R);
for (int i=1;i<=n;++i)
scanf("%lf%lf",&p[i].x,&p[i].y);
solve();
return 0;
}