Input file: | input.txt | Time limit: | 2 sec | |
Output file: | output.txt | Memory limit: | 64 Mb |
Define the function rm sum_of_digits(a) 〈 a ∈ N0〉 = k∑i = 0ai where {ai} is the representation of a in the numeral system with radix 10.
Define the function:
rm digitalization(a) 〈 a ∈ N0〉 = {
bf if rm sum_of_digits(a) ∈ 0..9 {
bf return rm sum_of_digits(a)
}
bf else {
bf return rm digitalization(rm sum_of_digits(a))
}
}
Your problem is to find rm digitalization(n!) for given n.
n
rm digitalization(n!)
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|