您的位置:首页 > 其它

ural 1333 Genie Bomber 2

2014-03-22 21:19 387 查看
#include <cstdio>
#include <cstring>
#include <algorithm>
#define maxn 200
using namespace std;

double x[maxn],y[maxn],r[maxn];

double sqr(double x)
{
return x*x;
}

int main()
{
int t;
scanf("%d",&t);
for(int i=0; i<t; i++)
{
scanf("%lf%lf%lf",&x[i],&y[i],&r[i]);
}
for(int i=0; i<t; i++) r[i]*=r[i];
int ans=0;
for(double x1=0; x1<=1; x1+=0.001)
{
for(double y1=0; y1<=1; y1+=0.001)
{
bool flag=false;
for(int j=0; j<t; j++)
{
if(sqr(x1-x[j])+sqr(y1-y[j])<=r[j])
{
flag=true;
break;
}
}
if(flag) ans++;
}
}
printf("%.0lf",(double)ans/10000.0);
return 0;
}


View Code
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: