![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数论
STDEN
这个作者很懒,什么都没留下…
展开
-
唯一分解定理
任何一个数都可已被分解为其质因数的平方 例如:18=23的平方 其因子个数为(1+1)(2+1)=6 #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; typedef long long ll; const int maxn=1000005; long long f[maxn],k,prime[maxn]; void su() { memset(f,0,siz原创 2021-05-18 08:23:03 · 145 阅读 · 0 评论 -
唯一分解定理
It’s said that Aladdin had to solve seven mysteries before getting the Magical Lamp which summons a powerful Genie. Here we are concerned about the first mystery. Aladdin was about to enter to a magical cave, led by the evil sorcerer who disguised himself原创 2020-06-04 21:33:23 · 167 阅读 · 0 评论 -
扩展欧几里得模板
long long ex(long long a,long long b,long long &c,long long &d) { if(b==0) { c=1; d=0; return a; } long long k=ex(b,a%b,c,d); long long t=d; d=c-(a/b)*d; c=t; return k; }原创 2021-05-17 10:07:20 · 106 阅读 · 0 评论 -
欧拉函数模板
目前有两种筛选法求欧拉函数 第一种:埃拉托斯特尼筛求欧拉函数 时间复杂度为o(n*ln ln n) void shai() { memset(prime,0,sizeof(prime)); prime[1]=1; for(int i=2;i<=maxn;i++) { if(prime[i]==0) { for(int j=i;j<=maxn;j+=i) {原创 2021-05-17 10:01:20 · 76 阅读 · 0 评论