Fork me on GitHub
摘要: //函数计算欧拉函数 int ola_phi(int n) { int m = (int)sqrt(n+0.5); int ans = n; for(int i=2;i 1) ans = ans/n*(n-1); } //筛出欧拉函数表 int phi[N]; void phi_table(int n) { for(int i=2;i<=n;i+... 阅读全文
posted @ 2014-06-28 21:45 whatbeg 阅读(571) 评论(0) 推荐(0) 编辑
摘要: ll exgcd(ll a,ll b,ll &x,ll &y) { if(!b) { x = (ll)1,y = (ll)0; return a; } ll r = exgcd(b,a%b,x,y); ll t = x; x = y; y = t - a/b*y; return r; } //计算模... 阅读全文
posted @ 2014-06-28 21:39 whatbeg 阅读(477) 评论(0) 推荐(0) 编辑
摘要: ll exgcd(ll a,ll b,ll &x,ll &y) { if(!b) { x = (ll)1,y = (ll)0; return a; } ll r = exgcd(b,a%b,x,y); ll t = x; x = y; y = t - a/b*y; return r; } //n个方... 阅读全文
posted @ 2014-06-28 21:30 whatbeg 阅读(456) 评论(0) 推荐(0) 编辑
摘要: 1.扩展欧几里得算法 2.快速幂法 阅读全文
posted @ 2014-06-28 21:24 whatbeg 阅读(254) 评论(0) 推荐(0) 编辑