福建2012年省赛I

来源:互联网 发布:js代码混淆工具 编辑:程序博客网 时间:2024/04/16 12:50



Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u
Submit Status Practice FZU 2110

Description

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

130 010 05 1000

Sample Output

1

#include<cstdio>#include<cstdlib>#include<cstring>#include<algorithm>#include<cmath>using namespace std;const int maxn=110;struct point{double x,y;}A[maxn];bool judge(point a,point b,point c){return (b.x-a.x)*(c.x-a.x)+(b.y-a.y)*(c.y-a.y)>0;}bool vis[110][110][110];int main(){int t,n,i,j,k;scanf("%d",&t);while(t--){scanf("%d",&n);for(i=0;i<n;++i){scanf("%lf%lf",&A[i].x,&A[i].y);}int ans=0;memset(vis,0,sizeof(vis));for(i=0;i<n;++i){for(j=0;j<n;++j){if(i==j)continue;for(k=0;k<n;++k){if(k==i||k==j)continue;if(vis[i][j][k])continue;if(judge(A[i],A[j],A[k])&&judge(A[j],A[i],A[k])&&judge(A[k],A[i],A[j]))ans++;vis[i][j][k]=vis[i][k][j]=vis[j][i][k]=vis[j][k][i]=vis[k][i][j]=vis[k][j][i]=1;}}} printf("%d\n",ans);}return 0;}


Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u
Submit Status Practice FZU 2110

Description

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

130 010 05 1000

Sample Output

1

0 0