Overpower often go to the playground with classmates. They play and chat on the playground. One day, there are a lot of stars in the sky. Suddenly, one of Overpower’s classmates ask him: “How many acute triangles whose inner angles are less than 90 degrees (regarding stars as points) can be found? Assuming all the stars are in the same plane”. Please help him to solve this problem.

Input

The first line of the input contains an integer T (T≤10), indicating the number of test cases.

For each test case:

The first line contains one integer n (1≤n≤100), the number of stars.

The next n lines each contains two integers x and y (0≤|x|, |y|≤1,000,000) indicate the points, all the points are distinct.

Output

For each test case, output an integer indicating the total number of different acute triangles.

Sample Input

1
3
0 0
10 0
5 1000

Sample Output

1

题目大意:有t组数据,每组数据线给出一个n,接下来有n个点。问由这些点组成的锐角三角形有多少个并输出。

锐角三角形判定:最大边的平方大于另外两条边的平方和即为锐角三角形。

code:

#include <cstdio>
#include <iostream> 
#include <algorithm>

using namespace std;
const int MAXN = 100+7;
typedef long long ll;

struct node{
	int x, y;
};
struct node a[MAXN];

ll powd(int x, int n)
{
	ll res = 1;
	while(n--)
		res *= x;
	return res;	
} 

int main()
{
	ios::sync_with_stdio(0); 
	int t;
	cin >> t;
	while(t--)
	{
		int n;
		cin >> n;
		for(int i=0; i<n; i++)
		{
			cin >> a[i].x >> a[i].y;
		}
		int ans = 0;
		ll len[3];
		for(int i=0; i<n; i++)
		{
			for(int j=i+1; j<n; j++)
			{
				for(int k=j+1; k<n; k++)
				{
					len[0] = powd(a[k].x - a[i].x, 2) + powd(a[k].y - a[i].y, 2);
					len[1] = powd(a[j].x - a[i].x, 2) + powd(a[j].y - a[i].y, 2);
					len[2] = powd(a[k].x - a[j].x, 2) + powd(a[k].y - a[j].y, 2);
					sort(len, len+3);
					if(len[0] + len[1] > len[2])
						ans ++; 
				}
			}
		}
		cout << ans << endl;
	}
	
	
	
	return 0;
}