# D. Vanya and Triangles(平面内三角形个数+精度)

https://codeforces.com/problemset/problem/552/D

#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=2e3+100;
typedef long long LL;
const LL inf=0x3f3f3f3f;
inline LL read(){LL x=0,f=1;char ch=getchar();	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
map<double,double>map1[maxn];
struct P{
double x,y;
}p[maxn];
double get(LL i,LL j)
{
LL y=p[i].y-p[j].y;
LL x=p[i].x-p[j].x;
if (!x)return 100000;
LL gd=__gcd(x,y);
x/=gd;
y/=gd;
return (y*1.0/x);
}
int main(void){
cin.tie(0);std::ios::sync_with_stdio(false);
LL n;cin>>n;
LL tot=n*(n-1)*(n-2)/6;
for(LL i=1;i<=n;i++){
cin>>p[i].x>>p[i].y;
}
for(LL i=1;i<=n;i++){
for(LL j=i+1;j<=n;j++){
double k=get(i,j);
map1[i][k]++;
}
}
LL ans=0;
for(LL i=1;i<=n;i++){
for(auto j:map1[i]){
if(j.second>=2){
ans+=(j.second)*(j.second-1)/2;
}
}
}
cout<<tot-ans<<"\n";
return 0;
}


©️2020 CSDN 皮肤主题: Age of Ai 设计师:meimeiellie