123456789101112131415161718192021222324252627282930
#include <iostream> #include <math.h> #include<iomanip> using namespace std; int main(int n) { cin >>n; double a[200],b[200],d[200],delta[200]; for(int i=0;i<n;i++) { cin >>d[i]; delta[i] = pow(d[i],2.0) - 4*d[i]; cout <<fixed << delta[i] << endl; if(delta[i]>0) { a[i] = (-d[i] + sqrt(delta[i])) / 2.0; b[i] = (-d[i] - sqrt(delta[i])) / 2.0; cout << "Y " << a << " "<< b<< endl ; } if(delta[i]==0) { a[i]=b[i]= -d[i]/2; cout <<"Y " << a << " "<< b << endl; } if(delta[i]<0){cout << "N" <<endl;} } return 0; }
cout << "Y " << a[i] << " "<< b[i] << endl ;