摘要: //回宿舍去了,明天做点难一点的题,今天做的都很水,感觉。没意思。#include #include using namespace std;const __int64 MOD=10; __int64 Power(__int64 a,__int64 b,__int64 m){ a%=m; __... 阅读全文
posted @ 2014-08-30 22:12 chenjunjie1994 阅读(109) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include using namespace std; int n,M=9973;struct Matrax { int m[15][15];}; Matrax a,per; void initial(){ int i,j; ... 阅读全文
posted @ 2014-08-30 22:08 chenjunjie1994 阅读(128) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std;const __int64 MOD=200907;__int64 Power(__int64 a,__int64 b,__int64 m){ a%=m; __int64 ans=1; while(b){ if(b&1){ ... 阅读全文
posted @ 2014-08-30 22:01 chenjunjie1994 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 找规律吧。可以快速幂模#include #include using namespace std;__int64 Power(__int64 a,__int64 b,__int64 k){ __int64 ans=1; a%=k; while(b){ if(b&1){ ans=ans*a%k;... 阅读全文
posted @ 2014-08-30 21:47 chenjunjie1994 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 水题,结果MOD 10000#include #include using namespace std;int n=2,M=10000;struct Matrax { int m[35][35];}; Matrax a,per; void initial(){ int i,j; f... 阅读全文
posted @ 2014-08-30 21:02 chenjunjie1994 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 简单的快速幂取模题但要注意由于a可能很大,相乘会超范围,所以乘前要先模#include #include using namespace std;int quick(int a,int b,int m){ int ans=1; a%=m; while(b){ if(b&1){ ans=(ans... 阅读全文
posted @ 2014-08-30 20:53 chenjunjie1994 阅读(254) 评论(0) 推荐(0) 编辑
摘要: 二分二分二分。。记录二分的点。1600多MS,应该 可以再优化#include #include #include #include using namespace std;int stack[150],sp;int n,M;struct Matrax { int m[35][35];};Matra... 阅读全文
posted @ 2014-08-30 16:48 chenjunjie1994 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 特判B不能大于等于C高次同余方程#include #include #include #include #include using namespace std;const int Maxn=65535;struct hash{ int a,b,next;}Hash[Maxn*2];int flag... 阅读全文
posted @ 2014-08-30 14:59 chenjunjie1994 阅读(266) 评论(0) 推荐(0) 编辑
摘要: 高次同余方程。 BL == N (mod P)求解最小的L。由于数据范围很大,暴力不行这里用到baby_step,giant_step算法。意为先小步,后大步。令L=i*m+j (m=ceil(sqrt(p-1))),那么原式化为 B^(i*m)*B^j==N(MOD P)————》B^j===N*... 阅读全文
posted @ 2014-08-30 14:55 chenjunjie1994 阅读(204) 评论(0) 推荐(0) 编辑
摘要: Babystep算法。具体为什么,我也不太明白,好像资料不多。#include #include #include #include #include using namespace std;const int Maxn=65535;struct hash{ int a,b,next;}Hash[M... 阅读全文
posted @ 2014-08-30 14:07 chenjunjie1994 阅读(208) 评论(0) 推荐(0) 编辑