Pagini recente » Solutii preONI 2007, Runda 2 | Cod sursa (job #3126532) | Cod sursa (job #2742029) | Cod sursa (job #996648) | Cod sursa (job #3257156)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("pachete.in");
ofstream fout("pachete.out");
int n, cnt = 0, sol[50010];
struct pereche {
///cine stie cunoaste
int x, y;
void read() { fin >> x >> y; }
}v[50010];
pereche start;
inline int ecDreptei(int x, int y, int x1, int y1, int x2, int y2) {
///verifica daca (x, y) e pe dreapta care trece prin (x1, y1) si (x2, y2) cf ec dr
return (((x - x1) * (y2 - y1)) == ((x2 - x1) * (y - y1)));
}
int main()
{
fin >> n;
start.read();
for(int i=1; i<=n; i++) v[i].read();
for(int i=1; i<=n; i++) {
bool ok = false;
for(int j=1; j<=cnt && !ok; j++)
if(ecDreptei(v[i].x, v[i].y, start.x, start.y, v[sol[j]].x, v[sol[j]].y)) ok = true;
if(!ok) sol[++cnt] = i;
}
fout << cnt;
return 0;
}