a53

ecuatie4

a53
Nov 11th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. int a, b, x, y, r;
  5.  
  6. int main()
  7. {
  8. cin>>a>>b;
  9. x = a;
  10. y = b;
  11. if(a > 1)
  12. {
  13. while(x % y)
  14. {
  15. r = x % y;
  16. x = y;
  17. y = r;
  18. }
  19. a = a / y; b = b / y;
  20. }
  21. for(int x = 1; x <= 200; x++)
  22. {
  23. if(a * x - b >0)
  24. {
  25. if((b * x) % (a * x - b)==0)
  26. {
  27. if( x <= (b * x) / (a * x - b))
  28. cout<<x<<" "<<(b *x)/(a * x - b)<<'\n';
  29. else
  30. break;
  31. }
  32.  
  33. }
  34.  
  35. }
  36. return 0;
  37. }
Add Comment
Please, Sign In to add comment