#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define PI acos(-1.0)
using namespace std;
struct node
{
int x,y,r;
double k;
bool operator<(const node &a)const
{
return k<a.k;
}
void init()
{
scanf("%d%d",&x,&y);
k=atan2(y,x);
r=x*x+y*y;
}
}p[5060];
double a[10000];
int vis[2000000],n,k;
int main()
{
int t=0;
double res;
while(~scanf("%d%d",&n,&k)&&(n+k))
{
t++;
res=1e9;
for(int i=0;i<n;i++)
p[i].init();
sort(p,p+n);
printf("Case #%d: ",t);
if(k==0)
printf("0.00\n");
else
{
for(int i=0;i<n;i++)
{
int cnt=0,len=p[i].r;
if(vis[len]==t)
continue;
vis[len]=t;
for(int j=0;j<n;j++)
if(p[j].r<=len)
a[cnt++]=p[j].k;
if(cnt<k)
continue;
for(int j=0;j<cnt;j++)
{
double temp;
if(j+k-1<cnt)
temp=a[j+k-1]-a[j];
else
temp=a[k-(cnt-j)-1]-a[j]+2*PI;
res=min(res,len*temp/2);
}
}
printf("%.2f\n",res);
}
}
}LA 4356
最新推荐文章于 2025-10-09 16:07:47 发布
本文介绍了一个使用C++解决的极坐标下圆覆盖问题。通过定义结构体存储圆心坐标及角度,并利用atan2函数计算角度,对圆进行排序。程序实现了通过调整半径大小寻找能够覆盖特定数量点的最小面积圆。适用于算法竞赛和几何问题求解。

1520

被折叠的 条评论
为什么被折叠?



