Description
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
Sample Input
Sample Output
<span style="font-size:14px;"># include <cmath>
# include <cstdio>
# include <iostream>
# include <algorithm>
using namespace std;
double p[110][2];
int main()
{
int T,n;
scanf("%d",&T);
while(T--)
{
scanf("%d",&n);
int i,j,k,ans=0;
double a,b,c;
for(i=0;i<n;i++)
scanf("%lf%lf",&p[i][0],&p[i][1]);
for(i=0;i< n-2;i++)
for(j=i+1;j< n-1;j++)
for(k=j+1;k< n;k++)
{
a=(p[i][0]-p[j][0])*(p[i][0]-p[j][0])+(p[i][1]-p[j][1])*(p[i][1]-p[j][1]);
b=(p[j][0]-p[k][0])*(p[j][0]-p[k][0])+(p[j][1]-p[k][1])*(p[j][1]-p[k][1]);
c=(p[k][0]-p[i][0])*(p[k][0]-p[i][0])+(p[k][1]-p[i][1])*(p[k][1]-p[i][1]);
if(a+b>c && a+c>b && b+c>a ) ans++;
}
printf("%d\n",ans);
}
return 0;
}</span>原文:http://blog.csdn.net/rechard_chen/article/details/41964947