The main topic: give you n points, calculate how many acute triangle.
Number of acute triangle = (number of acute angles in figure-Blunt right angle number)/3
There are several blunt right angles, acute angles in the calculation diagram. Enumerates the vertices of a corner, and then enumerates the edges that the vertex leads to, which can be represented by a vector. These vectors are sorted in polar order, enumeration of the starting edge, the method of the ruler, calculated with the edge of a sharp angle, blunt right side of the bar number. Statistics, and finally output the answer.
#include <bits/stdc++.h> using namespace std;
Const Double Pi=acos (-1);
const int maxn=2000+5;
const double eps=1e-12;
typedef long Long LL;
struct point{double x, y;
Double angle;
BOOL operator< (Point ZZ) const{return angle<zz.angle;
}}P[MAXN];
Point A[maxn*2];
int main () {int n;
while (~SCANF ("%d", &n)) {int x, y;
for (int i=0;i<n;i++) scanf ("%d%d", &x,&y), p[i].x=x,p[i].y=y;
ll Ans1=0,ans2=0;
for (int i=0;i<n;i++) {int siz=0;
for (int j=0;j<n;j++) {if (i==j) continue;
a[siz]=point{p[j].x-p[i].x,p[j].y-p[i].y,0};
A[siz].angle=atan2 (a[siz].y,a[siz].x); siz++;
} sort (A,a+siz);
for (int j=siz;j<2*siz;j++) {a[j].angle=a[j-siz].angle+2*pi;
} int s=1,t=1,len=1; for (int j=0;j<siz;j++) {while (a[t].angle-a[j].angle<p i&&t<2*siz) t++;
while (A[s].angle-a[j].angle<0.5*pi&&s<2*siz) s++;
while (A[len].angle-a[j].angle<eps&&len<2*siz) len++;
Ans1=ans1+t-s;
Ans2=ans2+s-len;
}} printf ("%i64d\n", (ans2-ans1*2)/3);
} return 0;
}