This documentation is automatically generated by online-judge-tools/verification-helper
View the Project on GitHub maspypy/library
#include "nt/digit_sum.hpp"
#pragma once int digit_sum(u64 x) { const int K = 100'000; static vc<int> dp(K); if (dp[1] == 0) { FOR(x, 1, K) dp[x] = dp[x / 10] + (x % 10); } int res = 0; while (x) { res += dp[x % K]; x /= K; } return res; }
#line 2 "nt/digit_sum.hpp" int digit_sum(u64 x) { const int K = 100'000; static vc<int> dp(K); if (dp[1] == 0) { FOR(x, 1, K) dp[x] = dp[x / 10] + (x % 10); } int res = 0; while (x) { res += dp[x % K]; x /= K; } return res; }