迴圈

輸入

利用克拉瑪法則判別

輸出

 

#include <cstdio>

 

 

using namespace std;

int main()
{
    double a, b, c, d, e, f, det, detx, dety;

    while(~scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f))
    {
        det = a*e-b*d;
        detx = c*e-f*b;
        dety = a*f-d*c;

        if (!det && (detx || dety))
            printf("No answer");
        else if (!det && !detx && !dety)
            printf("Too many");
        else
            printf("x=%.2lf\ny=%.2lf\n", detx/det, dety/det);
    }

    return 0;
}

arrow
arrow
    全站熱搜

    大神(偽) 發表在 痞客邦 留言(0) 人氣()