CF——Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017)

[C. Five Dimensional Points](http://codeforces.com/contest/851/problem/C)

1.2D时设原点为好点,所以最多周围有4个点,x,y正负轴上;3D时加2个(z轴),所以5D时最多周围由10个点,加上本身,最多11点。当n > 11时,输出0;
2.当n < 11 枚举,0 < t = cos <= 1 时是坏点;

AC code ``` #include #include #include #include

double dx(int i,int j,int k)
{
return ((T[j].a-T[i].a)(T[k].a - T[i].a) + (T[j].b-T[i].b)(T[k].b-T[i].b)+(T[j].c-T[i].c)(T[k].c- T[i].c)+(T[j].d-T[i].d)(T[k].d-T[i].d) + (T[j].e-T[i].e)*(T[k].e-T[i].e));
}

int main()
{
int n;
cin >> n;
for(int i = 0; i < n; i++)
scanf("%d%d%d%d%d",&T[i].a,&T[i].b,&T[i].c,&T[i].d,&T[i].e);

if(n > 11) {cout << "0" << endl;return 0;}

for(int i = 0; i < n; i++)
{

	bool flag = false;   
	for(int j = 0; j < n; j++)
	{
		if(j == i) continue;
		for(int k = 0; k < n; k++)
		{  
			if(k == j || k == i) continue;
			double t = dx(i,j,k)/sqrt(dd(i,j)*dd(i,k));
			if(t <= 1 && t > 0)
			flag = true;
			if(flag)	break;
		}
		if(flag) break;	 	
	}
	if(flag)  continue;
	ans[s++] = i+1;
}

sort(ans,ans+s);
    cout << s << endl;
for(int i = 0; i < s; i++)
  printf("%d\n",ans[i]);
    return 0;

}

你可能感兴趣的:(数学数论)