n! means n x (n-1) x ... x 3 x 2 x 1. For example, 10! = 3628800, and the sum of its digits is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27. Given n, find the sum of the digits of n!.
Example 1:
Example 2:
Example 3:
Constraints:
1 <= n <= 1000
Tags: