![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
欧拉函数
文章平均质量分 67
wwt9b15bs
这个作者很懒,什么都没留下…
展开
-
【题解】LightOJ1007Mathematically Hard 欧拉函数
题目链接//预处理出欧拉函数 #include<cstdio>#include<cstring>typedef unsigned long long ll;const int N=5e6+10;ll phi[N];void init(){ memset(phi,0,sizeof(phi)); phi[1]=1; int i,j;...原创 2018-08-10 22:13:30 · 103 阅读 · 0 评论 -
【模板】欧拉函数
#include<cstdio>const int N=1e5+10;int phi[N];void phi_table(int n)//1~n中所有数的欧拉phi值 { for(int i=2;i<=n;i++)phi[i]=0; phi[1]=1; for(int i=2;i<=n;i++) if(!phi[i]) ...原创 2018-08-10 22:38:38 · 117 阅读 · 0 评论 -
【题解】poj3696 The Luckiest number 欧拉函数+快速幂
题目链接DescriptionChinese people think of ‘8’ as the lucky digit. Bob also likes digit ‘8’. Moreover, Bob has his own lucky number L. Now he wants to construct his luckiest number which is the mini...原创 2018-09-11 13:37:53 · 189 阅读 · 0 评论 -
【题解】poj3090 Visible Lattice Points(同洛谷P2158 [SDOI2008]仪仗队) 欧拉函数
题目链接DescriptionA lattice point (x, y) in the first quadrant (x and y are integers greater than or equal to 0), other than the origin, is visible from the origin if the line from (0, 0) to (x, y)...原创 2018-09-11 13:37:47 · 284 阅读 · 0 评论 -
【题解】洛谷P2303(bzoj2705)[SDOI2012]Longge的问题 欧拉函数
题目链接题目背景SDOi2012题目描述Longge的数学成绩非常好,并且他非常乐于挑战高难度的数学问题。现在问题来了:给定一个整数NNN,你需要求出∑i=1Ngcd(i,N)\sum_{i=1}^N\gcd(i, N)∑i=1Ngcd(i,N)。输入输出格式###输入格式:一个整数,为NNN。输出格式:一个整数,为所求的答案。输入输出样例输入样例#1:6输出样例#1...原创 2018-09-20 10:24:06 · 194 阅读 · 0 评论 -
【题解】洛谷P2568(bzoj2818)GCD 欧拉函数+前缀和
题目链接题目描述给定整数N,求1<=x,y<=N且Gcd(x,y)为素数的数对(x,y)有多少对.输入输出格式输入格式:一个整数N输出格式:答案输入输出样例输入样例#1:4输出样例#1:4说明对于样例(2,2),(2,4),(3,3),(4,2)1<=N<=10^7#include<cstdio>typedef long l...原创 2018-09-20 11:04:53 · 259 阅读 · 0 评论