s8pc_3_e/Main.cpp
// Count number of triangles whose area is less than X
// Another point comes right to others.
// i : position of the point
// X : target area size
Count number of triangles whose area is less than X
Another point comes right to others.
i : position of the point
X : target area size
Count number of triangles whose area is less than X Another point comes right to others . i : position of the point X : target area size
int count(int i, double X) {
	int all = (N - i) / 2;
	int l = 0, r = all + 1;
	while(r - l > 1) {
		int m = (l + r) / 2;
		double area = (s[i] + s[m] + s[N - i - m]) / 2.0;
		if (area > X) r = m;
		else l = m;
	}
	if (r == all + 1) return N - i - 1;
	return l * 2;
}
int count ( int i , double X ) { int all = ( N - i ) / 2 ; int l = 0 , r = all + 1 ; while ( r - l > 1 ) { int m = ( l + r ) / 2 ; double area = ( s [ i ] + s [ m ] + s [ N - i - m ] ) / 2.0 ; if ( area > X ) r = m ; else l = m ; } if ( r == all + 1 ) return N - i - 1 ; return l * 2 ; }
Count number of triangles whose area is less than X
Another point comes right to others.
Count number of triangles whose area is less than X Another point comes right to others .