// System Of Linear Equation By Multidimensional Matrix
// 2x + 5y = 24
// 7x - 2y = 6
//
// A = |2   5|   ,   X = |24  5|  ,   Y = |2 24|
//     |7  -2|   ,       | 6 -2|  ,       |7  6|
//
// x = X/A and y = Y/A

#include<iostream>

using namespace std;

int main()
{
    int A[2][2] = { {2, 5}, {7, -2} };
    int X[2][2] = { {24, 5}, {6, -2} };
    int Y[2][2] = { {2, 24}, {7, 6} };

    int detA = A[0][0] * A[1][1] - A[0][1] * A[1][0];
    int detX = X[0][0] * X[1][1] - X[0][1] * X[1][0];
    int detY = Y[0][0] * Y[1][1] - Y[0][1] * Y[1][0];

    int x = detX / detA;
    int y = detY / detA;

    cout << "x = " << x << ", y = " << y << endl;

    return 0;
}
