Skip to content

Instantly share code, notes, and snippets.

@iamstarlee
Created November 12, 2018 18:14
Show Gist options
  • Save iamstarlee/61a828e91ba1c471d60f16526a7a09fb to your computer and use it in GitHub Desktop.
Save iamstarlee/61a828e91ba1c471d60f16526a7a09fb to your computer and use it in GitHub Desktop.
Educational Codeforces Round 54 (Rated for Div. 2)
#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;
}
@iamstarlee
Copy link
Author

just have a try

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment