a410.
解方程
--
TYVJ
| From: [1.173.16.17] |
發表日期
:
2015-04-30 18:09
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
float a,b,c,d,e,f,n,m,y,x;
int i;
while(scanf("%f %f %f %f %f %f",&a,&b,&c,&d,&e,&f)!=EOF)
{
n=b*d-e*a;
m=c*d-a*f;
y=m/n;
x=(c-y*b)/a;
if((b*d==a*e)&&(c*d==a*f))
{
printf("Too many\n");
continue;
}
if(((b * d) - (a * e)) == 0 && ((d * c) - (a * f)) != 0)
{
printf("No answer\n");
continue;
}
else
{
printf("x=%.2f\n",x);
printf("y=%.2f\n",y);
}
}
return 0;
}
我的答案是x=inf
正解x=-0.33
請問是哪裡錯了??