三角形
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cstdlib> #include <cmath> using namespace std; inline int read() { int res=0;char c=getchar();bool f=0; while(!isdigit(c)) {if(c=='-')f=1;c=getchar();} while(isdigit(c))res=(res<<3)+(res<<1)+(c^48),c=getchar(); return f?-res:res; } #define ll long long int n; ll C[3005][3005]; double slope[3005*3000]; int cnt, num; int x[3005], y[3005]; ll ans; int main() { freopen("triangle.in", "r", stdin); freopen("triangle.out", "w", stdout); n = read(); C[0][0] = 1; for (register int i = 1 ; i <= n ; i ++) { C[i][0] = 1; for (register int j = 1 ; j <= i ; j ++) C[i][j] = C[i-1][j-1] + C[i-1][j]; } ans = C[n][3]; for(register int i = 1 ; i <= n ; i ++) x[i] = read(), y[i] = read(); for (register int i = 1 ; i <= n - 1 ; i ++) { cnt = 0, num = 0; for (register int j = i + 1 ; j <= n ; j ++) { if (x[i] == x[j]) num++; else slope[++cnt] = (double)((y[i]-y[j]))/(double)((x[i]-x[j])); } sort(slope + 1, slope + 1 + cnt); int sum = 1; for (register int j = 2 ; j <= cnt ; j ++) { if (slope[j] == slope[j-1]) sum++; else { ans -= C[sum][2]; sum = 1; } } ans -= C[sum][2]; ans -= C[num][2]; } printf("%lld\n", ans); fclose(stdin), fclose(stdout); return 0; }