Pagini recente » Cod sursa (job #1851787) | Cod sursa (job #2156466) | Cod sursa (job #378797) | Cod sursa (job #1551109) | Cod sursa (job #2601827)
#include <bits/stdc++.h>
using namespace std;
using llong = int64_t;
ifstream fin("trapez.in");
ofstream fout("trapez.out");
const int val0 = 2 * 1e9 + 5;
unordered_map<double,int> pt;
vector<pair<int,int>> v;
int n;
llong nrT;
int main()
{
ios_base::sync_with_stdio(false);
fin.tie(0);
fout.tie(0);
fin >> n, v = vector<pair<int,int>> (n);
for (auto& it : v) fin >> it.first >> it.second;
for (int i = 0; i < n; ++i)
for (int j = i + 1; j < n; ++j)
{
double x = v[i].first - v[j].first, y = v[i].second - v[j].second;
nrT += pt[(y ? (x / y) : val0)]++;
}
fout << nrT;
}