Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // CF_TR4_A
- #define _CRT_SECURE_NO_WARNINGS
- #include <iostream>
- #include <cmath>
- using namespace std;
- int gcd(int x, int y)
- {
- if (x == 0) return y;
- else return gcd(y%x, x);
- }
- int main()
- {
- long long x1, y1, x2, y2, k = 0, a, b;
- cin >> x1 >> y1 >> x2 >> y2;
- //scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
- a = abs(x2 - x1);
- b = abs (y2 - y1);
- k = gcd (a,b);
- //cout << k;
- printf("%d", k+1);
- //system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement