题目链接:点击打开链接
五维空间下的锐角判定(包括0)只需判断向量的数量积是否大于0即可
暴力枚举所有可能性
AC代码如下:
#include <iostream>
#include <cmath>
#include <cstring>
using namespace std;
struct point{
int x1, x2, x3, x4, x5;
point operator-(const point& o)
{
point t;
t.x1 = x1-o.x1;
t.x2 = x2-o.x2;
t.x3 = x3-o.x3;
t.x4 = x4-o.x4;
t.x5 = x5-o.x5;
return t;
}
};
point pPoint[1005];
bool re[1005];
bool judge(point a, point b)
{
double temp = a.x1*b.x1+a.x2*b.x2+a.x3*b.x3+a.x4*b.x4+a.x5*b.x5;
return temp>0;
}
bool onLine(point a, point b)
{
if(a.x1*b.x2!=a.x2*b.x1) return false;
if(a.x2*b.x3!=a.x3*b.x2) return false;
if(a.x3*b.x4!=a.x3*b.x4) return false;
if(a.x4*b.x5!=a.x5*b.x4) return false;
return true;
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n;
while(cin>>n)
{
fill(re+1,re+1+n,1);
for(int i=1;i<=n;++i)
{
cin>>pPoint[i].x1>>pPoint[i].x2;
cin>>pPoint[i].x3>>pPoint[i].x4>>pPoint[i].x5;
}
int cnt=0;
for(int i=1;i<=n;++i)
{
int flag=0;
for(int j=1;j<=n;++j)
{
if(j==i) continue;
for(int k=1;k<=n;++k)
{
if(k==i||k==j) continue;
point a = pPoint[j]-pPoint[i];
point b = pPoint[k]-pPoint[i];
if(judge(a,b)) { flag=1; break; }
}
if(flag) break;
}
if(flag) { cnt++; re[i]=0;}
}
cout<<n-cnt<<endl;
for(int i=1;i<=n;++i)
if(re[i]) cout<<i<<endl;
}
return 0;
}