import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
static double eps=0.01;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int cases = Integer.parseInt(br.readLine());
for (int i = 0; i < cases; i++) {
String[]str=br.readLine().split(" ");
double x=Double.parseDouble(str[0]);
double y=Double.parseDouble(str[1]);
double max=func(x,y);
System.out.printf("%.2f %.2f\n",ans(x,y,max,Math.PI),max);
}
}
static double func(double a, double b) {
double temp = Math.sqrt(a*a+b*b);
return temp;
}
static double ans(double x, double y,double max,double pi) {
if(x==0 && y==0)
return 0;
double i;
for(i=Math.atan(x/y); i <= 2*pi; i+=pi/2) {
if(Math.abs(x*Math.sin(i)+y*Math.cos(i)-max) < eps && i>=0)
break;
}
return i;
}
}
No comments:
Post a Comment