上一页 1 ··· 24 25 26 27 28 29 30 31 32 ··· 38 下一页
摘要: //回宿舍去了,明天做点难一点的题,今天做的都很水,感觉。没意思。#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) 编辑
摘要: #include #include #include #include using namespace std;const int MaxM=11;int a[MaxM],b[MaxM];void exgcd(int a,int b,int &d,int &x,int &y){ if(b==0){ ... 阅读全文
posted @ 2014-08-29 20:49 chenjunjie1994 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 特判r1=0时的情况,因为0是不能模的。#include #include #include #include using namespace std;const int MaxM=11;int a[MaxM],b[MaxM];void exgcd(int a,int b,int &d,int &x... 阅读全文
posted @ 2014-08-29 20:43 chenjunjie1994 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 和POJ 1061一样要求最小解,就尽可能的把ax的值附到by上去,所以可以有ax=b*k+a*v(因为附到by上后必须仍上a*x的形式)。两边同除a就可得到结果。但是,我们知道,(a,b)=1。所以k|a,也就是说,ans=(x%b+b)%b。后来加上b是为了防止负数。#include #incl... 阅读全文
posted @ 2014-08-29 19:41 chenjunjie1994 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 线性同余方程组,模板了。但要注意读完数据才跳出循环啊#include #include #include #include using namespace std;void exgcd(__int64 a,__int64 b,__int64 &d,__int64 &xx,__int64 &yy){ ... 阅读全文
posted @ 2014-08-29 16:20 chenjunjie1994 阅读(139) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std;int main(){ int a,b; while(scanf("%d%d",&a,&b)!=EOF){ if(!a&&!b) break; int ans=1; for(int i=1;i<=b;... 阅读全文
posted @ 2014-08-29 15:13 chenjunjie1994 阅读(83) 评论(0) 推荐(0) 编辑
上一页 1 ··· 24 25 26 27 28 29 30 31 32 ··· 38 下一页