Created
November 12, 2018 18:14
-
-
Save iamstarlee/61a828e91ba1c471d60f16526a7a09fb to your computer and use it in GitHub Desktop.
Educational Codeforces Round 54 (Rated for Div. 2)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<cmath> | |
#include<iomanip> | |
#include<cstdio> | |
using namespace std; | |
int main() | |
{ | |
int n; | |
cin>>n; | |
while(n--) | |
{ | |
int d; | |
cin>>d; | |
if(d==0) | |
{ | |
cout<<"Y"<<" "<<0.000000000<<" "<<0.000000000<<endl; | |
continue; | |
} | |
if(d<4) | |
{ | |
cout<<"N"<<endl; | |
} | |
else | |
{ | |
double a, b; | |
a=(d+sqrt(d*d-4*d))/2; | |
b=d-a; | |
cout<<"Y "<<setiosflags(ios::fixed)<<setprecision(9)<<max(a, b)<<" "<<setprecision(9)<<min(a, b)<<endl; | |
printf("Y %.9f %.9f\n",max(a, b), min(a, b)); | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
just have a try