Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

SQUAREV - Revenge of the squares

I think it's time to not only solve problems but also create some.
So here is my first attempt:
Given a number calculate the product N of their digits bigger than zero. The output is the number R of different presentations of N in the form A*A+B*B with A and B being positive integers including zero. 1*1+2*2 and 2*2+1*1 are not different presentations. So for input 5 the output is 1.

See also this similar task.

Input

One hundred tests with one positive integer < 10^20.

Output

Print the illustrated above number R for each test.

Example

Input:
5
7
78185824586267361855 Output: 1
0
3

Added by:HWK
Date:2011-02-27
Time limit:2.394s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: SCM qobi

hide comments
2011-05-29 06:59:26 HWK
@Jander: Well done. I've already awaited this.
But in BALLSREM 51 bytes are still waiting for you. ;-)

Last edit: 2011-05-29 07:02:32
2011-05-27 18:52:47 HWK
@clytorock: You did it!
2011-03-10 11:46:02 HWK
@hallvabo: It was a pleasure for me to challenge you. I used Perl for my solution.
@ .::Debanjan::. : Sometimes a spoiler could also be interesting.
2011-03-09 20:49:07 :(){ :|: & };:

@HWK: If by my interesting remarks you meant the link to the paper I posted before then I believed it to be a spoiler hence I removed it.
2011-03-09 16:43:45 Hallvard Norheim Bø
@HWK: Thanks for a great challenge! I did struggle a bit at first myself. Which language do you use for the 47 bytes solution?
2011-03-09 14:27:09 HWK
@ .::Debanjan::. : It's a pity that you've removed your first comment. Now hallvabos answer is a little bit out of context. And your remarks were quite interesting. So why have you erased it?
2011-02-27 22:14:14 Hallvard Norheim Bø
Hint: remember it is the product of digits in the input number you should process, not the input number itself. Thus you already have a (partial) factorization.
2011-02-27 21:59:53 :(){ :|: & };:

@hallvabo: Thanks for your suggestion I did utilize your hint to solve it in the main site.


Last edit: 2011-03-07 18:33:32
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.