Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- double a, b, c, d, e, f, det, x, y, n, k;
- cin >> a >> b >> c >> d >> e >> f;
- det = a * d - c * b;
- if (det != 0)
- {
- x = (e * d - f * b) / (a * d - c * b);
- y = (a * f - c * e) / (a * d - c * b);
- cout << 2 << " " << x << " " << y;
- }
- else
- {
- if ((e * d - f * b) == 0 && (a * f - c * e) == 0)
- {
- if (a == 0 && b == 0 && c == 0 && d == 0) {
- if (e != 0 || f != 0) cout << 0;
- else cout << 5;
- }
- else
- {
- if (a == 0 && c == 0)
- {
- if (b != 0) { y = e / b; cout << 4 << " " << y; }
- else { y = f / d; cout << 4 << " " << y; }
- }
- else
- {
- if (b == 0 && d == 0)
- {
- if (a != 0) { x = e / a; cout << 3 << " " << x; }
- else { x = f / c; cout << 3 << " " << x; }
- }
- else
- {
- if (b != 0)
- {
- n = e / b;
- k = -a / b;
- cout << 1 << " " << k << " " << n;
- }
- else
- {
- n = f / d;
- k = -c / d;
- cout << 1 << " " << k << " " << n;
- }
- }
- }
- }
- }
- else { cout << 0; }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement