Pagini recente » Cod sursa (job #2072684) | Istoria paginii utilizator/kangjiyoung | Profil Raissa_14 | Skiplists | Cod sursa (job #2012561)
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define oo 1000000000
#define PII pair <int, int>
using namespace std;
int n, rs;
double a[1010], b[1010];
unordered_map < double , int > M;
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);
ifstream cin("trapez.in");
ofstream cout("trapez.out");
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i] >> b[i];
for (int i = 1; i < n; i++)
for (int j = i + 1; j <= n; j++)
M[(a[i] - a[j]) / (b[i] - b[j])]++;
for (auto it : M) rs += it.y * (it.y - 1) / 2;
cout << rs;
}