#11658: 為什麼WA???


shiningtang (04唐湘怡306)

學校 : 臺北市私立延平高級中學
編號 : 60243
來源 : [49.158.170.23]
最後登入時間 :
2022-04-26 13:32:07
a410. 解方程 -- TYVJ | From: [203.72.178.252] | 發表日期 : 2017-01-04 16:12

#include <iostream>
#include <iomanip>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv)
{
float a,b,c,d,e,f;
while(cin>>a>>b>>c>>d>>e>>f)
{
float y=(a*f-d*c)/(-d*b+a*e);
float x=(c-b*y)/a;
if(a/d==b/e&&b/e==c/f)
cout<<"Too many"<<endl;
else if(a/d==b/e&&b/e!=c/f)
cout<<"No answer"<<endl;
else
{
printf("x=%.2lf\n",x);
printf("y=%.2lf\n",y);
}

}
return 0;
}

 
ZeroJudge Forum