题目链接

水题,卡了下下精度。

 #include <cstdio>
#include <iostream>
#include <cmath>
using namespace std ;
#define PI acos(-1.0)
#define eps 1e-8
int judge(double x,double y)
{
double a;
a = x-y;
if(a < )
a = -a;
if(a < eps)
return ;
else
return ;
}
int main()
{
double x,y,lx,rx,ly,ry,a;
int t;
scanf("%d",&t);
while(t--)
{
scanf("%lf%lf",&x,&y);
a = PI/*;
lx=x*cos(a)-y*sin(a);
ly=x*sin(a)+y*cos(a);
rx=x*cos(a)+y*sin(a);
ry=-x*sin(a)+y*cos(a);
if(ly - ry > eps)
{
swap(ly,ry);
swap(lx,rx);
}
else if(judge(ly,ry))
{
if(lx - rx > eps)
{
swap(ly,ry);
swap(lx,rx);
}
}
printf("%.3lf %.3lf %.3lf %.3lf\n",lx,ly,rx,ry);
}
return ;
}
05-11 22:23