Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- using namespace std;
- int nod(int a, int b) {
- while (a != b)
- a > b ? a -= b : b -= a;
- return a;
- }
- int main(){
- setlocale(0, "");
- srand(time(NULL));
- int a1 = rand() % 10000 + 1;
- int b1 = rand() % 10000 + 1;
- int c1 = rand() % 10000 + 1;
- int d1 = rand() % 10000 + 1;
- int a2 = rand() % 10000 + 1;
- int b2 = rand() % 10000 + 1;
- int c2 = rand() % 10000 + 1;
- int d2 = rand() % 10000 + 1;
- int x0 = rand() % 10000 + 1;
- int y0 = rand() % 10000 + 1;
- int z0 = rand() % 10000 + 1;
- cout << a1 << " " << b1 << " " << c1 << " " << d1 << " " << a2 << " " << b2 << " " << c2 << " " << d2 << " " << x0 << " " << y0 << " " << z0 << endl;
- long long lambda = ((a1 * x0 + b1 * y0 + c1 * z0 + d1) / (a2 * x0 + b2 * y0 + c2 * z0 + d2)) * (-1);
- cout << lambda << endl;
- int A = 2 * (a1 + lambda * a2);
- int B = 2 * (b1 + lambda * b2);
- int C = 2 * (c1 + lambda * c2);
- int D = 2 * (d1 + d2);
- cout << A << " " << B << " " << C << " " << D << endl;
- int n = nod(((A, B), C), D);
- cout << n << endl;
- cout << A / n << " " << B / n << " " << C / n << " " << D / n << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement