Guest User

Untitled

a guest
Oct 22nd, 2019
63
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int a,b,k,n;
  8. cin >> a >> b;
  9. k=1;
  10. do {k+=1;} while ((a*b*k+1)!=(round(sqrt(a*b*k+1)))*(round(sqrt(a*b*k+1))));
  11. n=sqrt(a*b*k+1);
  12. if ((a<b) && (b-a)==2){cout << (b+a)/2;}
  13. else {cout << n;};
  14. return 0;
  15. }
RAW Paste Data