韦达定理推二元一次方程再求根公式直接算
2025-08-19 20:04:07
发布于:广东
11阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
ll t;cin>>t;
while(t--)
{
ll d;cin>>d;
ll delta = dd-4d;
if(delta < 0)
cout<<"N"<<endl;
else
{
double x1 = (d-sqrt(delta))/2;
double x2 = (d+sqrt(delta))/2;
if(x1>=0&&x2>=0)
{
cout<<"Y ";
printf("%.6f %.6f\n",min(x1,x2),max(x1,x2));
}
}
//x^2 -d*x+ d
}
}
这里空空如也
有帮助,赞一个