Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program Project2;
- {$APPTYPE CONSOLE}
- uses
- SysUtils;
- const
- MAXIN = 100000;
- type
- point = record
- x, y: extended;
- end;
- vector = record
- x, y: extended;
- end;
- var
- n, m, k, i, j, p, w1, ans: integer;
- a: array [0..MAXIN] of point;
- v, w: vector;
- r, x1, y1: extended;
- function max(a, b: integer): integer;
- begin
- if (a > b) then
- max := a
- else
- max := b;
- end;
- function make_vector(point1, point2: point): vector;
- begin
- make_vector.x := point2.x - point1.x;
- make_vector.y := point2.y - point1.y;
- end;
- function cross_product(vector1, vector2: vector): extended;
- begin
- cross_product := vector1.x * vector2.y - vector2.x * vector1.y;
- end;
- begin
- readln(a[0].x, a[0].y, r);
- readln(n);
- p := 0;
- for i := 1 to n do
- begin
- read(x1, y1);
- if (sqrt(sqr(a[0].x - x1) + sqr(a[0].y - y1)) <= r) then
- begin
- inc(p);
- a[p].x := x1;
- a[p].y := y1;
- end;
- end;
- for i := 1 to n do
- begin
- m := 0;
- k := 0;
- w := make_vector(a[0], a[i]);
- for j := 1 to n do
- if (i <> j) then
- begin
- v := make_vector(a[0], a[j]);
- if (cross_product(w, v) >= 0) then
- inc(k)
- else
- inc(m);
- end;
- ans := max(ans, max(m, k));
- end;
- writeln(ans);
- readln;
- readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement