Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
最近几何题比较火In Reply To:这道题有什么陷阱啊??怎么就过不了了?? Posted by:sexboy at 2005-07-24 11:18:24 > #include <iostream> > #include <cmath> > #include <algorithm> > #define pi 3.141592653589793238 > using namespace std; > int main() > { > freopen("in.txt","r",stdin); > double x,y,r,ax,ay,temp; > int dot,t,i,j,max,sum,sumofcentre; > while(cin>>x>>y>>r&&r>=0) > { > double node[1000]={0}; > cin>>dot; > for(t=sumofcentre=0;dot;--dot) > { > cin>>ax>>ay; > if((ax-x)*(ax-x)+(ay-y)*(ay-y)<=r*r) > { > temp=atan((ay-y)/(ax-x)); > if(ax-x>0) > { > if(ay-y>=0)node[t++]=temp; > else node[t++]=2*pi+temp; > } > else if(ax-x==0) > { > if(ay-y>0)node[t++]=pi/2; > else if(ay-y==0)++sumofcentre; > else node[t++]=3*pi/2; > } > else node[t++]=pi+temp; > } > } > sort(node,node+t); > for(i=max=0;i<t-1;++i) > { > for(j=i+1,sum=1+sumofcentre;j<t;++j) > { > if(node[j]-node[i]<=pi) > ++sum; > else break; > } > if(sum>max)max=sum; > } > cout<<max<<endl; > } > return 0; > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator