Pagini recente » Cod sursa (job #281351) | Cod sursa (job #1497332) | Cod sursa (job #814869) | Cod sursa (job #1372144) | Cod sursa (job #523314)
Cod sursa(job #523314)
#include <fstream>
#include <iostream>
#define LL long long
#define Nmax 1002
#define INF 994325093
using namespace std;
int n;
double panta[Nmax * Nmax];
LL dimp = 0;
struct punct
{
LL x, y;
};
punct a[Nmax];
void pantaa(LL x1, LL y1, LL x2, LL y2)
{
dimp++;
if(x1 == x2 || y1 == y2)
panta[dimp] = INF;
else
panta[dimp] = abs(y1 - y2) / (double) abs(x1 - x2);
}
int main()
{
ifstream f("trapez.in");
ofstream g("trapez.out");
f >> n;
for(int i = 1; i <= n; ++i)
{
f >> a[i].x >> a[i].y;
for(int j = 1; j < i; ++j)
pantaa(a[i].x, a[i].y, a[j].x, a[j].y);
}
sort(panta + 1, panta + dimp + 1);
/*for(int i = 1; i <= dimp; ++i)
cout << panta[i] << '\n';*/
LL j, i, k = 0;
for(i = 1; i <= dimp; i = j + 1)
for(j = i + 1; j <= dimp && fabs(panta[i] - panta[j]) <= 0.000001; ++j)
++k;
g << k;
f.close();
g.close();
return 0;
}