题意:给出一些五维坐标里的点,问有多少个好点,好点的定义为与其他任意2个点的向量夹角>=90°
思路:枚举,当这个点为好点的时候,我们可以确定另外2个点必为坏点,根据三角形内角和180°,然后跑就行
1 #include <bits/stdc++.h> 2 using namespace std; 3 4 const int N = 1e3+100; 5 int ans[N],vis[N],n; 6 struct node{ 7 int a,b,c,d,e; 8 }x[N]; 9 int check(int i,int j,int k) { 10 int sum=(x[j].a-x[i].a)*(x[k].a-x[i].a)+(x[j].b-x[i].b)*(x[k].b-x[i].b)+(x[j].c-x[i].c)*(x[k].c-x[i].c) 11 + (x[j].d-x[i].d)*(x[k].d-x[i].d)+(x[j].e-x[i].e)*(x[k].e-x[i].e); 12 return sum; 13 } 14 int main() { 15 int n; 16 scanf("%d",&n); 17 for(int i = 1; i <= n; ++i) { 18 scanf("%d%d%d%d%d",&x[i].a,&x[i].b,&x[i].c,&x[i].d,&x[i].e); 19 } 20 for(int i=1;i<=n;++i) { 21 int t= 0; 22 if(vis[i]) continue; 23 for(int j=1;j<=n;++j) { 24 for(int k = 1; k <= n; ++k) { 25 if(i == j || j ==k || i == k) continue; 26 if(check(i,j,k) > 0) { 27 t = 1; 28 break; 29 } 30 else { 31 vis[j] = 1; 32 vis[k] = 1; 33 } 34 } 35 if(t) break; 36 } 37 if(t) vis[i] = 1; 38 } 39 int sum= 0; 40 for(int i = 1; i <= n; ++i) if(!vis[i]) ans[++sum] = i; 41 cout<<sum<<endl; 42 for(int i = 1; i <= sum; ++i) cout<<ans[i]<<endl; 43 return 0; 44 }