码迷,mamicode.com
首页 >  
搜索关键字:phi    ( 1524个结果
BZOJ 2705: [SDOI2012]Longge的问题( 数论 )
---恢复内容开始--- T了一版....是因为我找质因数的姿势不对...考虑n的每个因数对答案的贡献. 答案就是 ∑ d * phi(n / d) (d | n) 直接枚举n的因数然后求phi就行了.但是我们可以做的更好. 注意到h(n) =∑ d * phi(n / d) (d | n) 是狄利...
分类:其他好文   时间:2015-07-29 00:47:54    阅读次数:117
hdu 4002 欧拉函数 2011大连赛区网络赛B
题意:求1-n内最大的x/phi(x)通式:φ(x)=x*(1-1/p1)*(1-1/p2)*(1-1/p3)*(1-1/p4)…..(1-1/pn),其中p1, p2……pn为x的所有质因数,x是不为0的整数。φ(1)=1(唯一和1互质的数就是1本身)。因此含质因数最多的即为所求,打表求出前n个积...
分类:其他好文   时间:2015-07-27 18:42:58    阅读次数:155
Codeforces 17D Notepad 简单的数论
从题意,anw = (b-1)*b^(n-1)%c,强调,为了b^(n-1)。弱渣只能推了宣传。phi(c)为小于c且与c互质的个数。当x >= phi(c)时:A^x = A(x%phi(c) + phi(c)) 。当x #include #include #include #include #i...
分类:其他好文   时间:2015-07-26 18:45:17    阅读次数:102
bzoj2190
题解来自lsj大神:假设C君为(0, 0), 则右上方为(n - 1, n - 1).phi(x)即欧拉函数是少于或等于n的数中与互质的数的数目Euler函数表达通式:euler(x)=x(1-1/p1)(1-1/p2)(1-1/p3)(1-1/p4)…(1-1/pn),其中p1,p2……pn为x的...
分类:其他好文   时间:2015-07-26 13:58:06    阅读次数:118
BZOJ 2190: [SDOI2008]仪仗队( 欧拉函数 )
假设C君为(0, 0), 则右上方为(n - 1, n - 1). 一个点(x, y) 能被看到的前提是gcd(x, y) = 1, 所以 answer = ∑ phi(i) * 2 + 2 - 1 = ∑phi(i) * 2 + 1 ( 1 using namespace std;const in...
分类:其他好文   时间:2015-07-26 10:57:58    阅读次数:108
仪仗队(欧拉函数模板)
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 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
UVA 10820 Send a Table euler_phi功能
除1,1其他外国x,y不等于为 x#include #include #include using namespace std;const int maxn=55000;long long int phi[maxn];void phi_table(){ phi[1]=1LL; for(i...
分类:其他好文   时间:2015-07-13 18:06:44    阅读次数:99
LDA主题模型学习笔记4:求解模型参数(M-step)
这一步,我们根据E-step得到的γ,phi\gamma,phi,最大化L(γ,?;α,β)L(\gamma,\phi;\alpha,\beta),得到α,β\alpha,\beta.1,拉格朗日乘数法求解β\beta     首先把L(γ,?;α,β)L(\gamma,\phi;\alpha,\beta)简化,只保留与β\beta有关的部分。因为β\beta是每一行存一个主题的词分布,所以每一行的...
分类:其他好文   时间:2015-07-02 12:08:22    阅读次数:229
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!