码迷,mamicode.com
首页 >  
搜索关键字:欧拉函数    ( 1054个结果
【BZOJ】2186 沙拉公主的困惑
一道非常有价值的题。 【解析1】欧几里德算法求乘法逆元,前缀和 [Analysis]O(T n log n)。 [Sum] ①int运算,如果会超出界,第一个数前要加上(LL)即类型转换。 ②gcd不变的欧几里德定理:可以是加,也可以是减。 [Code]/**********************************************************...
分类:其他好文   时间:2015-07-24 13:02:22    阅读次数:106
【SGU】SGU每日练1·Coprimes【数论】欧拉函数
先介绍欧拉函数及其相关定理吧:1.欧拉函数:对于任意一个数X,将其分解质因数为X=(P1^b1)*(P2^b2)*(P3^b3)......则小于X的与X互质的数的个数N为N = X * (1 - 1 / p1) * (1 - 1 / p2).......显然对于质数p,Euler(p) = p -...
分类:其他好文   时间:2015-07-21 01:01:12    阅读次数:188
仪仗队(欧拉函数模板)
1 long long euler_phi(int n) 2 { 3 int m=(int)sqrt(n+0.5); 4 int ans=n; 5 for(int i=2;i1)ans=ans/n*(n-1);14 return ans;15 }Descriptio...
分类:其他好文   时间:2015-07-19 20:03:03    阅读次数:137
Project Euler:Problem 72 Counting fractions
Consider the fraction, n/d, where n and d are positive integers. If nd and HCF(n,d)=1, it is called a reduced proper fraction. If we list the set of reduced proper fractions for d ≤ 8 in ascending or...
分类:其他好文   时间:2015-07-17 16:24:15    阅读次数:121
Project Euler:Problem 70 Totient permutation
Euler's Totient function, φ(n) [sometimes called the phi function], is used to determine the number of positive numbers less than or equal to n which are relatively prime to n. For example, as 1, 2,...
分类:其他好文   时间:2015-07-17 14:04:42    阅读次数:142
Project Euler:Problem 69 Totient maximum
Euler's Totient function, φ(n) [sometimes called the phi function], is used to determine the number of numbers less than n which are relatively prime to n. For example, as 1, 2, 4, 5, 7, and 8, are ...
分类:其他好文   时间:2015-07-17 10:05:11    阅读次数:174
欧拉函数+费马定理 POJ3358
题意:给一个分数p/q,求它的小数的二进制表示的循环部分的开始位置和循环长度。 对于一个十进制小数,求二进制的方法是不断的乘2取整数部分。所以首先把p/q化成最简的形式p'/q',然后对其不断乘2,直到p'*2^i == p'*2^j (mod q'),这时候循环就出现了,i是循环开始的位置,j-i是循环长度。 经过变换得到: p'*2^i*(2^(j-i)-1) ==0 (mod ...
分类:其他好文   时间:2015-07-16 22:24:24    阅读次数:140
uva10820 send a table (nlogn求1-n欧拉函数值模版
//重点就是求1-n的欧拉函数啦,重点是nlogn求法的版//大概过程类似于筛选法求素数 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include10 #inc...
分类:其他好文   时间:2015-07-15 06:29:20    阅读次数:330
仪仗队 求n以内欧拉函数值的和
I - 仪仗队 Time Limit:10000MS     Memory Limit:265216KB     64bit IO Format:%lld & %llu Submit Status Description   作为体育委员,C君负责这次运动会仪仗队的训练。仪仗队是由学生组成的N * N的方阵,为了保证队伍在行进中整齐划一,C君会跟在仪仗队的左后方...
分类:其他好文   时间:2015-07-12 09:36:59    阅读次数:114
O(n)求素数,求欧拉函数,求莫比乌斯函数,求对mod的逆元,各种求
筛素数void shai() { no[1]=true;no[0]=true; for(int i=2;i<=r;i++) { if(!no[i]) p[++p[0]]=i; int j=1,t=i*p[1]; while(j<=p[0] && t<=r) { no...
分类:其他好文   时间:2015-07-08 10:58:41    阅读次数:162
1054条   上一页 1 ... 75 76 77 78 79 ... 106 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!