1041 - #include<iostream> #include<cmath> / +...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#include<iostream> #include<cmath> //ÏòÁ¿¼ÆËã + ½Ç¶È¼ÆËã using namespace std; int cx,cy; double radius; const double eps=1e-7; struct Point { double ang; }; int num, base; Point tree[320]; int cmp(Point *a, Point *b){ if(a->ang < b->ang) return -1; else if(a->ang > b->ang ) return 1; return 0; } int readIn(){ int x,y,j=0; cin>>cx>>cy>>radius; if(radius < 0) return 0; radius *= radius; base = 0; cin>>num; for(int i=0;i<num;i++){ cin>>x>>y; x -= cx; y-= cy; if(x*x + y*y <= radius){ if(x ==0 ){ if(y==0){ base ++; } else { tree[j].ang = M_PI/2; } } else if(y==0) { if(x > 0) tree[j].ang = 0; else tree[j].ang = M_PI; } else { tree[j].ang = y; tree[j].ang /= x; if(tree[j].ang < 0){ tree[j].ang = atan(tree[j].ang) + M_PI; } else { tree[j].ang = atan(tree[j].ang); } } if(y < 0){
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

1041 - #include&lt;iostream&gt; #include&lt;cmath&gt; / +...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online