第一
二阶矩阵
#include<stdio.h>
int main()
{
double a11,a12,b1,a21,a22,b2;
scanf("%lf %lf %lf",&a11,&a12,&b1);
scanf("%lf %lf %lf",&a21,&a22,&b2);
double D,D1,D2;
D = a11*a22-a12*a21;
D1 = b1*a22-b2*a12;
D2 = a11*b2-b1*a21;
double x1,x2;
x1 = D1/D;
x2 = D2/D;
printf("%lf %lf",&x1,&x2);
return 0;
}
#include<stdio.h>
int main()
{
double a11,a12,a13,b1,a21,a22,a23,b2,a31,a32,a33,b3;
scanf("%lf %lf %lf %lf",&a11,&a12,&a13,&b1);
scanf("%lf %lf %lf %lf",&a21,&a22,&a23,&b2);
scanf("%lf %lf %lf %lf",&a31,&a32,&a33,&b3);
double D,D1,D2,D3;
D = a11*a22*a33+a12*a23*a31+a13*a21*a32-a13*a22*a31-a12*a21*a33-a11*a23*a32;
D1 = b1*a22*a33+a12*a23*b3+a13*b2*a32-a13*a22*b3-a12*b2*a33-b1*a23*a32;
D2 = a11*b2*a33+b1*a23*a31+a13*a21*b3-a13*b2*a31-b1*a21*a33-a11*a23*b3;
D3 = a11*a22*b3+a12*b2*a31+b1*a21*a32-b1*a22*a31-a12*a21*b3-a11*b2*a32;
double x1,x2,x3;
x1 = D1/D;
x2 = D2/D;
x3 = D3/D;
printf("%lf %lf %lf",&x1,&x2,&x3);
return 0;
}