Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int a, b, x, y, r;
- int main()
- {
- cin>>a>>b;
- x = a;
- y = b;
- if(a > 1)
- {
- while(x % y)
- {
- r = x % y;
- x = y;
- y = r;
- }
- a = a / y; b = b / y;
- }
- for(int x = 1; x <= 200; x++)
- {
- if(a * x - b >0)
- {
- if((b * x) % (a * x - b)==0)
- {
- if( x <= (b * x) / (a * x - b))
- cout<<x<<" "<<(b *x)/(a * x - b)<<'\n';
- else
- break;
- }
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment