forked from marioyc/Online-Judge-Solutions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1041 - Transmitters.cpp
executable file
·66 lines (50 loc) · 1.32 KB
/
1041 - Transmitters.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include<iostream>
#include<vector>
using namespace std;
struct punto{
int x;
int y;
punto(int a, int b){
x=a;
y=b;
}
};
int dist2(punto a, punto &b){
return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
int area(punto &a, punto &b, punto &c){
return a.x*b.y+b.x*c.y+c.x*a.y-a.y*b.x-b.y*c.x-c.y*a.x;
}
int main(){
freopen("in.txt","r",stdin);
freopen("out.txt","w",stdout);
int Ox,Oy,x,y,N,mx,cont1,cont2,S;
double r;
vector<punto> v;
while(1){
cin>>Ox>>Oy>>r;
if(r<0) break;
cin>>N;
punto O=punto(Ox,Oy);
v.clear();
for(int i=0;i<N;i++){
cin>>x>>y;
if(dist2(punto(x,y),O)<=r*r) v.push_back(punto(x,y));
}
mx=0;
for(int i=0;i<v.size();i++){
cont1=cont2=0;
for(int j=0;j<v.size();j++){
S=area(O,v[j],v[i]);
if(S==0){
cont1++;
cont2++;
}else if(S>0) cont1++;
else cont2++;
}
mx=max(mx,max(cont1,cont2));
}
cout<<mx<<endl;
}
return 0;
}