Pagini recente » Monitorul de evaluare | Monitorul de evaluare | Istoria paginii runda/contest1234 | Istoria paginii runda/cls11_round1 | Cod sursa (job #2785487)
#include <bits/stdc++.h>
using namespace std;
inline void Open(const string Name) {
#ifndef ONLINE_JUDGE
(void)!freopen((Name + ".in").c_str(), "r", stdin);
(void)!freopen((Name + ".out").c_str(), "w", stdout);
#endif
}
unordered_map <double, int> H;
int x[1001], y[1001];
int N, ans;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
Open("trapez");
cin >> N;
for(int i = 1;i <= N;i++)
cin >> x[i] >> y[i];
for(int i = 1;i < N;i++)
for(int j = i + 1;j <= N;j++) {
double val = (double)(y[j] - y[i]) / (x[j] - x[i]);
if(H.find(val) != H.end()) {
ans += H[val];
H[val]++;
} else {
H.insert({val, 1});
}
}
cout << ans;
return 0;
}