转化成用gcd做以后,然后简化公式,结论题_(:з」∠)_
(不过我算不出来就是了2333
(不过我算不出来就是了2333
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
#define ll long long
ll a,b,i,j,c,d;
ll gcd(ll a,ll b){
return b?gcd(b,a%b):a;
}
int main(){
while (~scanf("%I64d%I64d",&a,&b)){
c=gcd(a,b);
d=a*a-4*b*c;
if (d<0){
puts("No Solution");
continue;
}
i=(a-sqrt(d))/2/c;
j=(a+sqrt(d))/2/c;
if (i*j*c==b) printf("%I64d %I64d\n",i*c,j*c);
else puts("No Solution");
}
return 0;
}