QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#472213 | #6412. Classical Geometry Problem | UESTC_xxx# | WA | 0ms | 3840kb | C++20 | 2.0kb | 2024-07-11 15:05:30 | 2024-07-11 15:05:31 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
#include<cmath>
#include<stack>
#include<vector>
#include<map>
#define ll long long
#define lowbit(x) x&(-x)
using namespace std;
int tt,a,b,c;
double d;
struct N{
int a,b,c;
double d;
}ans[5];
struct node{
int a,b,c;
}x;
double L(node a){
return sqrt(a.a*a.a+a.b*a.b+a.c*a.c);
}
node mis(node a,node b){
node c;
c.a=a.a-b.a,c.b=a.b-b.b,c.c=a.c-b.c;
return c;
}
node mul(node a,double f){
a.a*=f,a.b*=f,a.c*=f;
return a;
}
void sol(){
node p,v;
double l,d;
p.a=p.b=p.c=255;
v=mis(p,x);
if(x.a==255) d=0;
else{
v=mul(v,255/(255-x.a));
l=L(v);
d=1.0*x.a*l/v.a;
x.a=0,x.b-=1.0*v.b*d/l,x.c-=1.0*v.c*d/l;
}
ans[3].a=p.a,ans[3].b=p.b,ans[3].c=p.c,ans[3].d=d;
p.a=0,p.b=p.c=255;
v=mis(p,x);
if(x.b==255) d=0;
else{
v=mul(v,255/(255-x.b));
l=L(v);
d=1.0*x.b*l/v.b;
x.b=0,x.c-=1.0*v.c*d/l;
}
ans[2].a=p.a,ans[2].b=p.b,ans[2].c=p.c,ans[2].d=d;
p.a=p.b=0,p.c=255;
v=mis(p,x);
if(x.c==255) d=0;
else{
v=mul(v,255/(255-x.c));
l=L(v);
d=1.0*x.c*l/v.c;
}
ans[1].a=p.a,ans[1].b=p.b,ans[1].c=p.c,ans[1].d=d;
}
int main(){
scanf("%d",&tt);
while(tt--){
scanf("%d%d%d",&a,&b,&c);
x.a=a,x.b=b,x.c=c;
if(a<=b&&b<=c) sol();
else if(a<=c&&c<=b){
swap(b,c);
sol();
for(int i=1;i<=3;++i) swap(ans[i].b,ans[i].c);
}
else if(b<=a&&a<=c){
swap(a,b);
sol();
for(int i=1;i<=3;++i) swap(ans[i].a,ans[i].b);
}
else if(b<=c&&c<=a){
swap(b,c),swap(a,c);
sol();
for(int i=1;i<=3;++i) swap(ans[i].b,ans[i].c),swap(ans[i].a,ans[i].c);
}
else if(c<=a&&a<=b){
swap(b,c),swap(a,b);
sol();
for(int i=1;i<=3;++i) swap(ans[i].b,ans[i].c),swap(ans[i].a,ans[i].b);
}
else if(c<=b&&b<=a){
swap(a,c);
sol();
for(int i=1;i<=3;++i) swap(ans[i].a,ans[i].c);
}
printf("3\n");
for(int i=1;i<=3;++i) printf("%d %d %d %lf\n",ans[i].a,ans[i].b,ans[i].c,ans[i].d);
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3840kb
input:
3 105 255 175 174 174 174 0 0 0
output:
3 0 255 0 252.875000 0 255 255 0.000000 255 255 255 119.000000 3 0 0 255 0.000000 0 255 255 0.000000 255 255 255 301.376841 3 0 0 255 0.000000 0 255 255 0.000000 255 255 255 0.000000
result:
wrong answer too far from the target: (84.144246, 253.576202, 84.144246) instead of (105, 255, 175) (test case 1)