/** n! means n * (n - 1) * ... * 3 * 2 * 1 For example, 10! = 10 * 9 * ... * 3 * 2 * 1 = 3628800, and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27. Find the sum of the digits in the number 100! */ #include "0.hpp" #include "lib/lint.cpp" #define _max 100 uint sum(string a) { uint suma = 0; for(uint i = 0; i < a.size(); i++) suma += (a[i] - '0'); return suma; } int main() { lint a("1"); lint b; for(int i = 1; i <= _max; i++) { b = itos(i); a = a * b; } cout << sum(a.getd()) << endl; }