Pagini recente » Cod sursa (job #1225174) | Cod sursa (job #2011342) | Cod sursa (job #1345803) | Cod sursa (job #1094278) | Cod sursa (job #2973589)
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
vector<pair<int, int>> a(n);
vector<double> lines;
lines.reserve(n * n);
for (auto& [x, y] : a) cin >> x >> y;
for (int i = 0; i < n; i++) {
const auto& [x1, y1] = a[i];
for (int j = i + 1; j < n; j++) {
const auto& [x2, y2] = a[j];
lines.push_back((double)(x1 - x2) / (double)(y1 - y2));
}
}
sort(lines.begin(), lines.end());
int t = n * (n - 1), r = 0;
for (int i = 0, j = 0; i < n; i = j) {
while (j < n && lines[i] == lines[j]) j++;
r += (j - i) * (j - i - 1) / 2;
}
cout << r << '\n';
}
int main() {
#ifdef LOCAL
freopen("file.in", "r", stdin);
#else
freopen("trapez.in", "r", stdin);
freopen("trapez.out", "w", stdout);
#endif
ios_base::sync_with_stdio(false), cin.tie(NULL);
solve();
}