摘要: http://acm.timus.ru/problem.aspx?space=1&num=1684kmpView Code const int MM = 1111111;#define debug puts("wrong")typedef __int64 int64;char str[MM], ch[MM];int n,m;int fail[MM], ans[MM], cnt;void get_next(int n) { int i, j=-1; for(fail[0]=-1, i=1;i < n; i++) { while(j>=0 && 阅读全文
posted @ 2013-04-24 22:49 zhang1107 阅读(144) 评论(0) 推荐(0) 编辑
摘要: http://acm.timus.ru/problem.aspx?space=1&num=1682记录取模的余数,并查集。View Code const int MM = 511111;#define debug puts("wrong")typedef __int64 int64;int64 N;bool vis[MM];vector<int64>g[MM];vector<int64>gg[MM]; //^2int64 fa[MM], ran[MM];int64 getfa(int64 x) {return x==fa[x]?x:fa[x] 阅读全文
posted @ 2013-04-24 22:44 zhang1107 阅读(159) 评论(0) 推荐(0) 编辑
摘要: View Code /*==================================================*\| 求解 C(n,m)%p 保证p为素数n很大10^9 m很小10^5\*==================================================*/typedef __int64 int64;int64 N,M, mod;int64 p[MM];void get_data() { int i,j,k; scanf("%I64d%I64d%I64d",&N,&M,&mod);}int64 exp_ 阅读全文
posted @ 2013-04-24 10:59 zhang1107 阅读(158) 评论(0) 推荐(0) 编辑