摘要:
Lucas定理是用来求 c(n,m) mod p 的值(p为素数) 一般用于求组合数,防止其爆long long Lucas定理:我们令n=sp+q , m=tp+r .(q ,r ≤p) 那么: C(sp+q,tp+r)与C(s,t)*C(q,r)同余 (在编程时你只要继续对 调用Lucas定理即可。 代码可以递归的去完成这个过程,其中递归终点为t = 0 ; 时间O(log... 阅读全文
摘要:
Problem Description People in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (=17^2), i.e., 1... 阅读全文
摘要:
阅读全文