📄 3312921_ac_79ms_328k.cc
字号:
#include <stdio.h>
#include <math.h>
#include <string.h>
#define eps 1e-8
int main()
{
int n, m;
while (scanf("%d",&n)==1,n)
{
int mark[n];
double pot[n][3];
memset(mark,0,sizeof(mark));
for (int i = 0; i < n; i++)
{
scanf("%lf%lf%lf",&pot[i][0],&pot[i][1],&pot[i][2]);
}
scanf("%d",&m);
int cnt = 0;
double x, y, z, p;
for (int i = 0; i < m; i++)
{
scanf("%lf%lf%lf%lf",&x,&y,&z,&p);
for (int j = 0; j < n; j++)
{
if (mark[j])
{
continue;
}
double a, b, c, alpha;
a = sqrt(pot[j][0]*pot[j][0]+pot[j][1]*pot[j][1]+pot[j][2]*pot[j][2]);
b = sqrt(x*x+y*y+z*z);
c = sqrt((pot[j][0]-x)*(pot[j][0]-x)+(pot[j][1]-y)*(pot[j][1]-y)+(pot[j][2]-z)*(pot[j][2]-z));
alpha = acos((a*a+b*b-c*c)/2.0/a/b);
if (alpha <= p + eps)
{
mark[j] = 1;
cnt++;
}
}
}
printf("%d\n",cnt);
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -