Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. double a, b, c, d, e, f, det, x, y, n, k;
  5. cin >> a >> b >> c >> d >> e >> f;
  6. det = a * d - c * b;
  7. if (det != 0)
  8. {
  9. x = (e * d - f * b) / (a * d - c * b);
  10. y = (a * f - c * e) / (a * d - c * b);
  11. cout << 2 << " " << x << " " << y;
  12. }
  13. else
  14. {
  15. if ((e * d - f * b) == 0 && (a * f - c * e) == 0)
  16. {
  17. if (a == 0 && b == 0 && c == 0 && d == 0) {
  18.  
  19.  
  20. if (e != 0 || f != 0) cout << 0;
  21. else cout << 5;
  22. }
  23.  
  24. else
  25. {
  26.  
  27. if (a == 0 && c == 0)
  28. {
  29. if (b != 0) { y = e / b; cout << 4 << " " << y; }
  30. else { y = f / d; cout << 4 << " " << y; }
  31. }
  32. else
  33. {
  34. if (b == 0 && d == 0)
  35. {
  36. if (a != 0) { x = e / a; cout << 3 << " " << x; }
  37. else { x = f / c; cout << 3 << " " << x; }
  38. }
  39. else
  40. {
  41. if (b != 0)
  42. {
  43. n = e / b;
  44. k = -a / b;
  45. cout << 1 << " " << k << " " << n;
  46. }
  47. else
  48. {
  49. n = f / d;
  50. k = -c / d;
  51. cout << 1 << " " << k << " " << n;
  52. }
  53. }
  54. }
  55.  
  56. }
  57. }
  58. else { cout << 0; }
  59. }
  60.  
  61.  
  62. return 0;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement