ural 1333 Genie Bomber 2

 1 #include <cstdio>
 2 #include <cstring>
 3 #include <algorithm>
 4 #define maxn 200
 5 using namespace std;
 6 
 7 double x[maxn],y[maxn],r[maxn];
 8 
 9 double sqr(double x)
10 {
11     return x*x;
12 }
13 
14 int main()
15 {
16     int t;
17     scanf("%d",&t);
18     for(int i=0; i<t; i++)
19     {
20         scanf("%lf%lf%lf",&x[i],&y[i],&r[i]);
21     }
22     for(int i=0; i<t; i++) r[i]*=r[i];
23     int ans=0;
24     for(double x1=0; x1<=1; x1+=0.001)
25     {
26         for(double y1=0; y1<=1; y1+=0.001)
27         {
28             bool flag=false;
29             for(int j=0; j<t; j++)
30             {
31                 if(sqr(x1-x[j])+sqr(y1-y[j])<=r[j])
32                 {
33                     flag=true;
34                     break;
35                 }
36             }
37             if(flag) ans++;
38         }
39     }
40     printf("%.0lf",(double)ans/10000.0);
41     return 0;
42 }
View Code

 

posted @ 2014-03-22 21:19  null1019  阅读(105)  评论(0编辑  收藏  举报