Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- typedef long long unsigned big;
- big hcf(big a, big b) {
- while (b) {
- big temp = a;
- a = b;
- b = temp % b;
- }
- return a;
- }
- int main() {
- big x, y, x1, y1, x2, y2, h;
- cin >> x >> y;
- h = hcf(x, y);
- x = x / h;
- y = y / h;
- cin >> x1 >> y1 >> x2 >> y2;
- for (big i = 0; i < h - 1; i++) {
- big bigX = x + i * x;
- big bigY = y + i * y;
- if (!(bigX >= x1 && bigX <= x2 && bigY >= y1 && bigY <= x2)) {
- cout << "No" << endl << bigX << " " << bigY << endl;
- return 0;
- }
- }
- cout << "Yes" << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement