Pagini recente » Cod sursa (job #10059) | Cod sursa (job #122334) | Cod sursa (job #1059348) | Cod sursa (job #1756247) | Cod sursa (job #1907064)
#include<bits/stdc++.h>
#define x first
#define pb push_back
#define mp make_pair
#define y second
#define all(a) a.begin(), a.end()
#define l(x) (x<<1)
#define r(x) ((x<<1) | 1)
#define f(x) x>>1
#define lsb(x) (x&(-x))
using namespace std;
typedef long long LL;
typedef long double LD;
typedef vector<LL> VLL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef vector<int> VI;
typedef VI::iterator vit;
typedef tuple<int,int,int> PIII;
const LL INF=(1LL<<62);
const int MAXN=505;
const int LOGMAX=18;
const int MOD=70657;
const LD pi=acos(-1.0);
const int dx[] = {0, 1, 1, 0, -1, -1};
const int dy[] = {1, 0, -1, -1, 0, 1};
map<PII, int> M;
PII A[1005];
void solve(){
int n;
cin>>n;
for(int i=1; i<=n; ++i){
cin>>A[i].x>>A[i].y;
}
for(int i=1; i<=n; ++i)
for(int j=i+1; j<=n; ++j)
{
int vv = A[j].x - A[i].x;
int dd = A[j].y - A[i].y;
int dv = __gcd(vv, dd);
vv/=dv;
dd/=dv;
M[{dd, vv}]++;
}
LL rs=0;
for(auto el: M){
rs+=1LL*(el.y)*(el.y-1)/2;
}
cout<<rs<<"\n";
}
int main()
{
cout<<setprecision(6)<<fixed;
ios_base::sync_with_stdio(0);
cin.tie(0);
freopen("trapez.in", "rt", stdin);
freopen("trapez.out", "wt", stdout);
solve();
return 0;
}