Star

Star

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
//题意:给你三个或者三个以上的坐标点,问任意三点构成的三角形有多少个内角是不大于90度的。
//思路:用枚举,把点一一例举出来,然后求锐角三角形。
根据三角形定义来求:较小的两条边平方和大于较大的一条边的平和就是锐角三角形。
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
struct ma
{
   float x,y;       
}line[102];

float div(ma a,ma b)
{
   return  sqrt((b.x-a.x)*(b.x-a.x)+(b.y-a.y)*(b.y-a.y));
}
int main()
{
    int T,n,i,j,k;
    float la,lb,lc;
    while(scanf("%d",&T)!=EOF)
    {
      while(T--)
       {
         scanf("%d",&n);
          int s=0;
         for(i=0;i<n;i++)
          scanf("%f%f",&line[i].x,&line[i].y);
          
          for(i=0;i<n;i++)
           for(j=i+1;j<n;j++)
             for(k=j+1;k<n;k++)
             { 
              la=div(line[i],line[j]);
              lb=div(line[i],line[k]);
              lc=div(line[j],line[k]);
              if((la*la-(lb*lb+lc*lc)<0)&&(lb*lb-(la*la+lc*lc)<0)&&(lc*lc-(la*la+lb*lb)<0)) s++;
             }
              printf("%d\n",s);
              }
       }                          
    return 0;
} 


【资源介绍】 1、该资源包括项目的全部源码,下载可以直接使用! 2、本项目适合作为计算机、数学、电子信息等专业的课程设计、期末大作业和毕设项目,也可以作为小白实战演练和初期项目立项演示的重要参考借鉴资料。 3、本资源作为“学习资料”如果需要实现其他功能,需要能看懂代码,并且热爱钻研和多多调试实践。 图像数据处理工具+数据(帮助用户快速划分数据集并增强图像数据集。通过自动化数据处理流程,简化了深度学习项目的数据准备工作).zip 图像数据处理工具+数据(帮助用户快速划分数据集并增强图像数据集。通过自动化数据处理流程,简化了深度学习项目的数据准备工作).zip 图像数据处理工具+数据(帮助用户快速划分数据集并增强图像数据集。通过自动化数据处理流程,简化了深度学习项目的数据准备工作).zip 图像数据处理工具+数据(帮助用户快速划分数据集并增强图像数据集。通过自动化数据处理流程,简化了深度学习项目的数据准备工作).zip 图像数据处理工具+数据(帮助用户快速划分数据集并增强图像数据集。通过自动化数据处理流程,简化了深度学习项目的数据准备工作).zip 图像数据处理工具+数据(帮助用户快速划分数据集并增强图像数据集。通过自动化数据处理流程,简化了深度学习项目的数据准备工作).zip 图像数据处理工具+数据(帮助用户快速划分数据集并增强图像数据集。通过自动化数据处理流程,简化了深度学习项目的数据准备工作).zip 图像数据处理工具+数据(帮助用户快速划分数据集并增强图像数据集。通过自动化数据处理流程,简化了深度学习项目的数据准备工作).zip
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值