【题目链接】:http://codeforces.com/contest/514/problem/B
【题意】
每次攻击可以把经过自己的一条直线上的所有点都毁掉;
然后给你n个目标物的坐标
问你最少要攻击多少次才能把所有目标物全部毁掉
【题解】
因为每个目标物都会毁掉:
则肯定要射一次的(如果它没有被毁掉的话);
把在这条线上的点全都毁掉就好;
没有什么最小攻击次数的概念.
判断点在直线上用向量搞就好;
【Number Of WA】
0
【完整代码】
#include <bits/stdc++.h>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define ps push_back
#define fi first
#define se second
#define rei(x) scanf("%d",&x)
#define rel(x) scanf("%lld",&x)
#define ref(x) scanf("%lf",&x)
#define ms(x,y) memset(x,y,sizeof x)
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
const double pi = acos(-1.0);
const int N = 1100;
struct point{
int x,y;
bool killed;
};
bool in(point a,point b,point c)
{
return (b.x-a.x)*(c.y-a.y)==(c.x-a.x)*(b.y-a.y);
}
point a[N];
int x0,y0,n,ans = 0;
int main()
{
//freopen("F:\\rush.txt","r",stdin);
rei(n),rei(x0),rei(y0);
rep1(i,1,n)
rei(a[i].x),rei(a[i].y);
rep1(i,1,n)
if (a[i].killed==false)
{
a[i].killed = true;
rep1(j,i+1,n)
if (!a[j].killed && in(point{x0,y0},a[i],a[j]))
{
a[j].killed=true;
}
ans++;
}
cout << ans << endl;
//printf("\n%.2lf sec \n", (double)clock() / CLOCKS_PER_SEC);
return 0;
}