fork download
  1. #include <bits/stdc++.h>
  2. #include <iostream>
  3. using namespace std;
  4. #define Deghish ios_base::sync_with_stdio(false);cin.tie(NULL);
  5. double EPS=1e-10;
  6. void solve() {
  7. double d;cin>>d;
  8. if (d > 0 && d < 4) {
  9. cout << "N" << endl;
  10. return;
  11. }
  12. double aa,bb;
  13. double l=0,h=d/2;
  14. while (h-l>EPS) {
  15. double mid=(l+h)/2.0;
  16. double a=d-mid;
  17. double b=mid;
  18. if (a+b-d==EPS) {
  19. aa=a,bb=b;
  20. break;
  21. }
  22. if (a*b<d) {
  23. l=mid;
  24. }else {
  25. h=mid;
  26. }
  27. }
  28. cout<<fixed<<setprecision(9)<<"Y "<<aa<<" "<<bb<<endl;
  29. }
  30. signed main() {
  31. Deghish
  32. int Tc = 1;//
  33. cin >> Tc;
  34. while (Tc--) {
  35. solve();
  36. }
  37. return 0;
  38. }
  39.  
Success #stdin #stdout 0s 5320KB
stdin
7
69
0
1
4
5
999
1000
stdout
Y 67.985071300 1.014928700
Y 0.000000000 0.000000000
N
Y 2.000000015 1.999999985
Y 3.618033989 1.381966011
Y 997.998996990 1.001003010
Y 998.998997995 1.001002005