嗯...
自己看视频讲解?
1 #include<cstdio> 2 #include<queue> 3 #include<iostream> 4 #include<cstring> 5 #define int long long 6 using namespace std; 7 inline int read(){ 8 int ans=0,f=1;char chr=getchar(); 9 while(!isdigit(chr)){if(chr=='-') f=-1;chr=getchar();} 10 while(isdigit(chr)){ans=(ans<<3)+(ans<<1)+chr-48;chr=getchar();} 11 return ans*f; 12 }int ans=1,n,r; 13 signed main() { 14 r=n=read(); 15 if(!n) {puts("1");return 0;} 16 while(n&1^1) n>>=1; 17 for(int i=3,j;i*i<=r;++i) { 18 for(j=0;!(n%i);++j) n/=i; 19 if(i%4==1) ans*=j<<1|1; 20 }if(n>1&&n%4==1) ans*=3; 21 cout<<ans*4; 22 return 0; 23 }