2011年9月17日

求前n个Catalan数的和mod m的值——可作为求a/b mod m的模版

摘要: #include <iostream>#include <string.h>#include <stdio.h>usingnamespace std;#define N 110typedef longlong lld;int n,m,p;int sm[N],sa[N];lld sum,res;void extgcd(int a, int b, int& x, int& y){ if (b ==0) { x=1; y=0; return; } extgcd(b, a % b, x, y); int t = x; x = y; y = t - a 阅读全文

posted @ 2011-09-17 20:48 Moon_1st 阅读(345) 评论(0) 推荐(0) 编辑

数论——Lucas定理模板

摘要: FormulationFor non-negative integersmandnand a primep, the followingcongruence relationholds:whereandare the basepexpansions ofmandnrespectively.#include <iostream>#include <cstdio>#include <cstring>usingnamespace std;typedef longlong llg;constint N =150000;llg n, m, p, fac[N];void 阅读全文

posted @ 2011-09-17 13:42 Moon_1st 阅读(3554) 评论(0) 推荐(0) 编辑

导航