![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数论
z8853797
这个作者很懒,什么都没留下…
展开
-
hdu1164
Eddy's research I 讲一个数分解成多个质素的乘积。 晒个素数在判断下就可以。 #include #include #include #include #include using namespace std; int const M = 660000; int prime[10000]; bool flag[M]; void Judge(){ memset(原创 2014-01-30 01:10:02 · 825 阅读 · 0 评论 -
A/B
求出b的逆元就可以了。。费马小定理 #include #include #include using namespace std; typedef long long LL ; int const mod = 9973; LL Quick_Mod(LL a,LL b){ LL r = 1; while(b){ if(b & 1) r = (r * a)原创 2014-04-17 22:18:43 · 531 阅读 · 0 评论 -
FZU 2020
大整数取模,lucas 定理原创 2014-04-17 22:21:25 · 573 阅读 · 0 评论 -
Romantic
赤裸裸的扩展GCD。。。原创 2014-04-17 22:16:11 · 489 阅读 · 0 评论 -
青蛙的约会
扩展GCD 因为 跳跃的次数相同 ,设跳了S次原创 2014-04-17 22:14:46 · 435 阅读 · 0 评论 -
仿射密码
只要把模逆元求出来就很轻松了 #include #include #include using namespace std; int const mod = 26; char str[100]; int Expend_Gcd(int a,int n){ int p = a,q = n; int x = 0,y = 1; int z = q/p; while(原创 2014-02-28 16:15:01 · 828 阅读 · 0 评论 -
最大素因子
刚开始是用晒素数 然后 在进行枚举 + 判断,结果T了3发。。开始思考。最后突然明白。把晒素数的方法改下就可以了。 #include #include #include using namespace std; int const MAX = 1000010; int s[MAX],prime[MAX]; void Judge(){ memset(prime,0,sizeof(pr原创 2014-02-26 16:30:08 · 1630 阅读 · 0 评论 -
大整数取模
类似多项式求和的方法 #include #include #include using namespace std; #define LL long long int const M = 1000010; int const mod = 10003; char str[M]; int main(){ int n; scanf("%d",&n); while(n--)原创 2014-02-25 13:58:10 · 719 阅读 · 0 评论 -
最少乘法次数
类似快速幂的思想。2进制 #include #include #include using namespace std; int main(){ int m; scanf("%d",&m); while(m--){ int n,cnt = 0; int num[1000]; memset(num,0原创 2014-02-24 23:32:26 · 991 阅读 · 0 评论 -
hdu1222
GCD的运用 #include #include #include using namespace std; int Gcd(int x,int y){ if(y == 0)return x; else return Gcd(y,x % y); } int main(){ int n; scanf("%d",&n); while(n--){原创 2014-02-12 12:36:33 · 600 阅读 · 0 评论 -
hdu 1215
如果使用下面的方法肯定会T,忘记考虑了外面还有一个循环TLE的代码。 果断发现忘记考虑了 #include #include using namespace std; #define LL long long int main(){ int T,x; scanf("%d",&T); while(T--){//当T = 500000,时间复杂度有多高就不用说了。原创 2014-01-31 01:31:09 · 575 阅读 · 0 评论 -
ZOJ 3621 Factorial Problem in Base K
s! 在 K 进制下 有多少个0 fen原创 2014-07-16 20:28:32 · 549 阅读 · 0 评论