fork(2) download
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5. float a, b, c, d, e, f;
  6. float x, y;
  7. while(scanf("%f %f %f %f %f %f", &a, &b, &c ,&d, &e, &f) ==6)
  8. {
  9. x = (c*e - b*f) / (a*e - b*d);
  10. y = (f - d*x) / e;
  11. x *= 10000;
  12. y *= 10000;
  13. if(x >= 0)
  14. {
  15. x += 5;
  16. }
  17. else
  18. {
  19. x -= 5;
  20. }
  21. if(y >= 0)
  22. {
  23. y += 5;
  24. }
  25. else
  26. {
  27. y -= 5;
  28. }
  29. x /= 10000;
  30. y /= 10000;
  31. printf("%f %f\n", x, y);
  32. printf("%.3f %.3f\n\n", x, y);
  33. }
  34. return 0;
  35. }
  36.  
Success #stdin #stdout 0s 1724KB
stdin
1 2 3 4 5 6
2 -1 -2 -1 -1 -5
2 -1 -3 1 -1 -3
2 -1 -3 -9 9 27
stdout
-1.000500 2.000500
-1.000 2.000

1.000500 4.000500
1.000 4.001

0.000500 3.000500
0.001 3.000

0.000500 3.000500
0.001 3.000