mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
30 lines
560 B
C++
30 lines
560 B
C++
|
#include<stdio.h>
|
||
|
#include<math.h>
|
||
|
int main()
|
||
|
{
|
||
|
int k,i,j,n,ans;
|
||
|
while(~scanf("%d",&n))
|
||
|
{
|
||
|
if(!n)
|
||
|
{
|
||
|
printf("1\n");
|
||
|
continue;
|
||
|
}
|
||
|
ans=0;
|
||
|
k=(int)sqrt(n/2.0);
|
||
|
for(i=0;i<=k;++i)
|
||
|
{
|
||
|
j=(int)sqrt(n-i*i);
|
||
|
if(i*i+j*j==n)
|
||
|
{
|
||
|
if(i==j||i==0||j==0)
|
||
|
ans+=4;
|
||
|
else
|
||
|
ans+=8;
|
||
|
}
|
||
|
}
|
||
|
printf("%d\n",ans);
|
||
|
}
|
||
|
return 0;
|
||
|
}
|