Submit | All submissions | Best solutions | Back to list |
Problem hidden on 2013-07-09 22:56:01 by Mitch Schwartz
GOV03 - FACTORIAL CHALLENGE |
Govind is very fond of playing with factorial of numbers.
One day his brother Mukund gave him a challenge on factorials.
Since Govind finds it difficult to solve the problem, he asks you for assisstance.
Help him find the answer to the problem.
For a number Z, we write Z! as a x 10n where a is an integer not divisible by 10. n is also an integer.
let m = unit digit of a.
So, your task is to calculate the value of m+n.
Input
Input contais list of numbers for which answers are to be calculated. (Each number on a separate line)
All numbers are less than 109
Input will terminate with -1.
Output
For every number in input print the value of m+n.
Each answer should be on a separate line.
Do not process -1.(which shows end of input)
Example
Input:
2
100
-1
Output:
2
28
Explanation:
100! = 93326215443944152681699238856266700490715968264381621468592963895217599993229915..
..608941463976156518286253697920827223758251185210916864000000000000000000000000
Cleary in this case, m=4 and n=24.
So the answer is 28
Added by: | Govind Lahoti |
Date: | 2013-04-07 |
Time limit: | 0.200s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
Resource: | self |
hide comments
2013-04-07 18:42:25 Francky
This is only FCTRL+FCTRL4. In this case, we can't accept it as classical problem, nor tutorial, it is hidden. |
|
2013-04-07 18:15:47 :-)
very nice problem :-) |