标签:
Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 4817 | Accepted: 2576 |
Description
Input
Output
Sample Input
25 25 3.5 7 25 28 23 27 27 27 24 23 26 23 24 29 26 29 350 200 2.0 5 350 202 350 199 350 198 348 200 352 200 995 995 10.0 4 1000 1000 999 998 990 992 1000 999 100 100 -2.5
Sample Output
3 4 4
Source
1 /************************************************************************* 2 > File Name: code/poj/1106.cpp 3 > Author: 111qqz 4 > Email: rkz2013@126.com 5 > Created Time: 2015年11月09日 星期一 09时28分51秒 6 ************************************************************************/ 7 8 #include<iostream> 9 #include<iomanip> 10 #include<cstdio> 11 #include<algorithm> 12 #include<cmath> 13 #include<cstring> 14 #include<string> 15 #include<map> 16 #include<set> 17 #include<queue> 18 #include<vector> 19 #include<stack> 20 #include<cctype> 21 #define fst first 22 #define sec second 23 #define lson l,m,rt<<1 24 #define rson m+1,r,rt<<1|1 25 #define ms(a,x) memset(a,x,sizeof(a)) 26 using namespace std; 27 const double eps = 1E-8; 28 const int dx4[4]={1,0,0,-1}; 29 const int dy4[4]={0,-1,1,0}; 30 typedef long long LL; 31 const int inf = 0x3f3f3f3f; 32 const int N=2E4+7; 33 34 int n; 35 double r; 36 int dblcmp( double d) 37 { 38 return d<-eps?-1:d>eps; 39 } 40 struct point 41 { 42 double x,y; 43 point(){} 44 point(double _x,double _y): 45 x(_x),y(_y){}; 46 47 void input() 48 { 49 scanf("%lf %lf",&x,&y); 50 } 51 52 53 point operator - (const point &p)const{ 54 return point(x-p.x,y-p.y); 55 } 56 double operator ^(const point &p)const{ 57 return x*p.y-y*p.x; 58 } 59 double dis(point p) 60 { 61 return sqrt((x-p.x)*(x-p.x)+(y-p.y)*(y-p.y)); 62 } 63 }tmp[N],c,p[N]; 64 int main() 65 { 66 #ifndef ONLINE_JUDGE 67 freopen("in.txt","r",stdin); 68 #endif 69 while (~scanf("%lf %lf %lf",&c.x,&c.y,&r)) 70 { 71 int cnt = 0 ; 72 if (dblcmp(r)<=0) break; 73 scanf("%d",&n); 74 for ( int i = 0 ;i < n ; i ++) 75 { 76 tmp[i].input(); 77 double d =c.dis(tmp[i]); 78 if (dblcmp(d-r)<=0) 79 { 80 //p[cnt]=tmp[i]; 81 p[cnt].x=tmp[i].x; 82 p[cnt].y=tmp[i].y; 83 cnt++; 84 } 85 } 86 int ans = 0; 87 for ( int i = 0 ; i < cnt ; i++) 88 { 89 int sum = 1 ; 90 for ( int j = 0 ; j < cnt ; j++) 91 { 92 double cross = (c-p[i])^(c-p[j]); 93 if (cross>=0&&i!=j) 94 { 95 sum++; 96 } 97 } 98 ans = max(sum,ans); 99 } 100 printf("%d\n",ans); 101 } 102 103 104 #ifndef ONLINE_JUDGE 105 #endif 106 fclose(stdin); 107 return 0; 108 }
poj 1106 Transmitters (计算几何,叉积||极角排序)
标签:
原文地址:http://www.cnblogs.com/111qqz/p/4949128.html