QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#207640 | #6767. Hourly Coding Problem | veg# | WA | 1ms | 3728kb | C++23 | 1.5kb | 2023-10-08 18:10:16 | 2023-10-08 18:10:17 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define double long double
double len(double x1,double y1,double z1,double x2,double y2,double z2)
{
return sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)+(z2-z1)*(z2-z1));
}
double calc(double x1,double y1,double z1,double x2,double y2,double z2,double x3,double y3,double z3)
{
double a=len(x2,y2,z2,x3,y3,z3),b=len(x1,y1,z1,x3,y3,z3),c=len(x1,y1,z1,x2,y2,z2);
double p=(a+b+c)/2.0,s=sqrt(p*(p-a)*(p-b)*(p-c));
return sqrt(b*b-(s*2/c)*(s*2/c));
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int x,y,z,a,b,c;
scanf("%d%d%d%d%d%d",&x,&y,&z,&a,&b,&c);
double x1=0,y1=0,z1=0,x2=c,y2=0,z2=0;
double p=(a+b+c)/2.0,s=sqrt(p*(p-a)*(p-b)*(p-c));
double z3=0,y3=s*2/c,x3=sqrt(b*b-y3*y3)*(a*a>b*b+c*c?-1:1);
cout<<x1<<' '<<y1<<' '<<z1<<endl;
cout<<x2<<' '<<y2<<' '<<z2<<endl;
cout<<x3<<' '<<y3<<' '<<z3<<endl;
double k1=x*x-y*y+z2*z2+y2*y2+x2*x2;
double k2=x*x-z*z+z3*z3+y3*y3+x3*x3;
double k3=(2*x2*z3-2*x3*z2)/(2*y3*z2-2*y2*z3);
double k4=(k2*z2-k1*z3)/(2*y3*z2-2*y2*z3);
double k5=(-2*x2-2*y2*k3)/(2*z2);
double k6=(x*x-y*y+z2*z2+y2*y2+x2*x2-2*y2*k4)/(2*z2);
double x4=(-(k3*k4+k5*k6)+sqrt((k3*k4+k5*k6)*(k3*k4+k5*k6)-(1+k3*k3+k5*k5)*(k4*k4+k6*k6-x*x)))/(1+k3*k3+k5*k5);
double y4=k3*x4+k4,z4=k5*x4+k6;
double x5=(x1+x2+x3+x4)/4,y5=(y1+y2+y3+y4)/4,z5=(z1+z2+z3+z4)/4;
printf("-%.10Lf -%.10Lf -%.10Lf\n",calc(x4,y4,z4,x5,y5,z5,x1,y1,z1),calc(x4,y4,z4,x5,y5,z5,x2,y2,z2),calc(x4,y4,z4,x5,y5,z5,x3,y3,z3));
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3728kb
input:
3 7 3 5 1 0 2 7 -3 4 6 4 -1 3 -2 4 -3 5 6 2 0 -2 0 -1 -1 0
output:
0 0 0 2 0 0 -nan -nan 0 -nan -nan -nan 0 0 0 -1 0 0 nan -nan 0 -nan -nan -nan 0 0 0 6 0 0 4.33333 2.49444 0 -nan -nan -nan
result:
wrong answer 1st lines differ - expected: '3 3 1', found: '0 0 0'