zoj 2819 How I Wonder What Yo...

zoj 2819 How I Wonder What Yo...,第1张

zoj 2819 How I Wonder What Yo...
#include <iostream>#include <cstdio>#include <cmath>using namespace std;double a[600], b[600], c[600], a1[60], b1[60], c1[60], x, y, z, t, f[60];int n, m;int main(){ while(scanf("%d", &n)&&n) { for(int i= 0;i < n;i++) { scanf("%lf%lf%lf", &a[i], &b[i], &c[i]); } scanf("%d", &m); for(int i = 0;i < m;i++) { scanf("%lf%lf%lf%lf", &a1[i], &b1[i], &c1[i], &f[i]); } int sum = 0; for(int i = 0;i < n;i++) { int tag = 0; x = sqrt(a[i]*a[i] + b[i]*b[i] + c[i]*c[i]); for(int j = 0;j < m;j++) { if(!tag) { y = sqrt(a1[j]*a1[j] + b1[j]*b1[j] + c1[j]*c1[j]); z = sqrt((a[i]-a1[j])*(a[i]-a1[j]) + (b[i]-b1[j])*(b[i]-b1[j]) + (c[i]-c1[j])*(c[i]-c1[j])); t = (x*x+y*y-z*z)/2/x/y; if(f[j]-acos(t) > 1e-9) { tag = 1; sum ++; } } } } printf("%dn", sum); } return 0;}

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/4902433.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-12
下一篇 2022-11-12

发表评论

登录后才能评论

评论列表(0条)

保存