fork(3) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. double matrix[3][2];
  6. for (int i = 0; i < 2; ++i){
  7. for (int j = 0; j < 3; ++j){
  8. cin >> matrix[j][i];
  9. }
  10. }
  11. double d = matrix[0][0] * matrix[1][1] - matrix[0][1] * matrix[1][0];
  12. double d1 = matrix[2][0] * matrix[1][1] - matrix[2][1] * matrix[1][0];
  13. double d2 = matrix[0][0] * matrix[2][1] - matrix[0][1] * matrix[2][0];
  14. printf("%.3lf\n%.3lf\n", d1 / d, d2 / d);
  15. return 0;
  16. }
Success #stdin #stdout 0s 4348KB
stdin
5 8 11
-3 6 15
stdout
-1.000
2.000