diff --git a/src/P2822/P2822.cpp b/src/P2822/P2822.cpp index d452170..9fe8d80 100644 --- a/src/P2822/P2822.cpp +++ b/src/P2822/P2822.cpp @@ -14,7 +14,7 @@ static ull fact(const ull n)noexcept{ if(it != fact_map.end())return (*it).second; ull ret {1}; for(ull i{2};i<=n;i++){ - ret=(ret*i)%k; + ret=(ret%k*i%k); } fact_map.insert({n,ret}); return ret;