Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- int a,b,k,n;
- cin >> a >> b;
- k=1;
- do {k+=1;} while ((a*b*k+1)!=(round(sqrt(a*b*k+1)))*(round(sqrt(a*b*k+1))));
- n=sqrt(a*b*k+1);
- cout << n;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement