You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
531 B
C++
23 lines
531 B
C++
#include <cstdio>
|
|
#include <cmath>
|
|
using namespace std;
|
|
int main()
|
|
{
|
|
int T, a;
|
|
scanf("%d", &T);
|
|
while (~scanf("%d", &a))
|
|
{
|
|
if (a == 0)
|
|
printf("Y %.9lf %.9lf\n", 0, 0);
|
|
else if (a == 1 || a == 2 || a == 3)
|
|
puts("N");
|
|
else
|
|
{
|
|
double d = a;
|
|
double x = (d + sqrt(d - 4) * sqrt(d)) / 2;
|
|
double y = (d - sqrt(d - 4) * sqrt(d)) / 2;
|
|
printf("Y %.9lf %.9lf\n", x, y);
|
|
}
|
|
}
|
|
return 0;
|
|
} |