-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathPOJ1106(AC).cpp
59 lines (53 loc) · 943 Bytes
/
POJ1106(AC).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
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
using namespace std;
typedef struct Point{
double x;
double y;
}Point;
vector<Point> v;
Point tr;
double r;
int maxc;
double cross(const Point &a, const Point &b, const Point &c)
{
return (a.x - c.x) * (b.y-c.y) - (b.x - c.x) * (a.y - c.y);
}
int main()
{
int i, j, n;
int c;
Point p;
while(scanf("%lf%lf%lf", &tr.x, &tr.y, &r) == 3 && r >= 0){
scanf("%d", &n);
v.clear();
for(i = 0; i < n; ++i){
scanf("%lf%lf", &p.x, &p.y);
if((p.x - tr.x) * (p.x - tr.x) + (p.y - tr.y) * (p.y - tr.y) <= r * r){
v.push_back(p);
}
}
n = v.size();
maxc = 0;
for(i = 0; i < n; ++i){
c = 0;
for(j = 0; j < n; ++j){
if(cross(v[i], v[j], tr) <= 0){
++c;
}
}
if(2 * c < n){
c = n - c;
}
if(c > maxc){
maxc = c;
}
}
printf("%d\n", maxc);
}
return 0;
}