Given circle \ (Y ^ X ^ 2 + 2 ^ 2 = R & lt \) , there are the number of points required circumferential coordinates are integers. \ (r \ leq 2 \ times 10 ^ 9 \)
Solution
Into the original formula \ (R & lt ^ Y ^ 2 = 2-X ^ 2 = (RX) (R & lt + X) \) , provided \ (u, v \ st \ rx = du, r + x = dv, ( U, V) =. 1 \) , then \ (Y ^ 2 = D ^ 2UV \) , then \ (UV \) must be a perfect square, it can be provided \ (u = s ^ 2, v = t ^ 2 \) , there \ (y ^ 2 = d ^ 2s ^ 2t ^ 2 \)
Only consider the part in the first quadrant, set answer \ (ANS \) , then the answer to the original question is \ (4 (ans + 1) \)
Consider how to calculate \ (ANS \) , the \ (rx = du, r + x = dv \) solve for \ (x = \ frac {t ^ 2-s ^ 2} {2} d, \ 2r = (t S ^ 2 + 2 ^) D \) , so we can enumerate violence \ (2R \) submultiple of \ (D \) , each enumeration \ (S \) , which is calculated corresponding \ (T \) and then calculate the \ (x, y \) to see whether it legitimate to count the contribution
#include <bits/stdc++.h>
using namespace std;
#define int long long
int r;
signed main() {
int ans=0;
cin>>r;
for(int i=1;i*i<=2*r;i++) if(2*r%i==0) {
int d=i;
for(int s=1;s*s<=2*r/d;s++) {
int t=sqrt(2*r/d-s*s);
if(__gcd(s,t)!=1) continue;
if((t*t+s*s)==2*r/d) {
int x=(s*s-t*t)/2*d;
int y=d*s*t;
if(x>0&&y>0&&x*x+y*y==r*r) ans+=2;
}
}
if(i*i==2*r) continue;
d=2*r/i;
for(int s=1;s*s<=2*r/d;s++) {
int t=sqrt(2*r/d-s*s);
if(__gcd(s,t)!=1) continue;
if((t*t+s*s)==2*r/d) {
int x=(s*s-t*t)/2*d;
int y=d*s*t;
if(x>0&&y>0&&x*x+y*y==r*r) ans+=2;
}
}
}
cout<<4*(ans+1)<<endl;
}