SQUA_REV - Revenge of the squares
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.
Input
Twenty 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
hide comments
HWK:
2011-03-10 12:03:20
Primary I wrote this task for SHORTEN, i.e. to get small not fast code. It ended up in SPOJ classical accidentally. But there are two variations:
|
|
:(){ :|: & };::
2011-03-09 20:46:39
|
|
HWK:
2011-03-08 18:07:55
I think a smaller time-limit wouldn't change very much. If you don't understand the idea of the task solving in 10 sec. would just as difficult as in 1 sec. |
|
:(){ :|: & };::
2011-03-07 18:31:24
|
|
HWK:
2011-03-02 16:13:14
So I've changed SQUAREV, SQUAREV1 and EQUASOLV to none hoping the last two will appear in SHORTING too.
|
|
Piotr KÄ…kol:
2011-03-02 16:13:14
I'll try to explain everything.
|
|
HWK:
2011-03-02 16:13:14
This are problems of Piotr Kakol. Maybe he has got more options. |
|
numerix:
2011-03-02 16:13:14
There are problems in SHORTEN contest, that come from classical section (e.g. CANTON -> CANTON2) and other problems that don't appear in SPOJ main sections at all (e.g. ROMANCAL). So there must be a way to publish only in SHORTEN. |
|
HWK:
2011-03-02 16:13:14
To add a problem in SHORTEN (which was my intention) it seems to be necessary to be in challenge section. A classical problem wouldn't work. (That's the information of Piotr Kakol) So you will be right: Challenge will be more and more a shortening contest. Last edit: 2011-02-28 10:33:41 |
|
numerix:
2011-03-02 16:13:14
To me it doesn't matter, if it's in challenge or in classical section. On the other hand there are some new shortening problems in challenge and it should be avoided that challenge becomes too easy or will be more and more a shortening contest. So why not remove the sentence "Could you beat 47 bytes?" and leave it in classical with a restriction on size limit, so that it can be solved in many languages, but has to be in some way optimized according to size. Last edit: 2011-02-27 17:10:21 |
Added by: | HWK |
Date: | 2011-02-25 |
Time limit: | 1.096s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |