
Untitled
By: a guest on
Jul 31st, 2012 | syntax:
None | size: 0.80 KB | hits: 10 | expires: Never
#include<iostream>
#include<cmath>
using namespace std;
unsigned long long sq (unsigned long long a) {
unsigned long long res = 0;
for (unsigned long long i = 0; i < sqrt(a) ;++i){
if (i*i>=ceil(a/2.0) && a > 4){
break;
}
unsigned long long c = a-i*i;
if ((unsigned long long)(sqrt(c)) == sqrt(c)){
++res;
//cout<<" a : "<<a<<" | square : "<<i*i<<endl;
}
}
return res;
}
int main () {
char a [25];
while(scanf("%s",a)!= EOF) {
unsigned long long product = 1;
for (int i = 0; i < strlen(a);++i)
if (a[i] > '1')
product *= a[i]-'0';
printf("%llu\n",sq(product));
delete(a);
}
}