![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
---数论---
ThreeWater-
这个作者很懒,什么都没留下…
展开
-
17D 扩展欧拉函数
求(b-1)*(b)^(n-1)%c,b和n都是百万位数 b和b-1都能直接取模 两种方法: 一:问题在于降幂 a^b %c= a^(b%phi(c)+phi(c)) %c (b>=phi(c)) if(b#include <cstdio> #include <algorithm> #include <cstring> using namespace std; typedef long原创 2016-08-25 22:22:38 · 762 阅读 · 0 评论 -
求1e11以内的素数个数
#include<cstdio> #include<cmath> using namespace std; #define LL long long const int N = 5e6 + 2; bool np[N]; int prime[N], pi[N]; int getprime() { int cnt = 0; np[0] = np[1转载 2016-09-18 21:26:37 · 2137 阅读 · 0 评论 -
区间最多约数
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N=1e7+5,M=3200; vector<int> prime; int pri[M]={0}; int mx,ans; int pricnt; int li,ri; void f() { pri[0]=pri[1]=1; f原创 2017-07-08 11:04:31 · 333 阅读 · 0 评论 -
hdu6069
先枚举素因子,再枚举区间,每次跨越素数长度#include<bits/stdc++.h> using namespace std; typedef long long ll; int INF=0x3f3f3f3f; ll p[200005],cn=0,d[1000005]; ll aa[1000005],bb[1000005]; int main() { for(ll i=2; i<=100原创 2017-08-06 14:07:35 · 285 阅读 · 0 评论 -
线性序列 模版
typedef long long ll; // 线性序列 求第n项const ll mod=1000000007; ll quick_pow(ll a,ll b) {ll res=1;a%=mod;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;} const int N=10010; ll res[N],base[N],_c[N]原创 2017-08-26 14:41:05 · 603 阅读 · 0 评论