hdu 2824 The Euler function 欧拉函数模板题
2013-09-13 19:49
204 查看
#include <cstdio> #include <cstring> #include <cmath> #include <iostream> #include <algorithm> using namespace std; #define LL __int64 const LL maxn=3e6+10; LL phi[maxn+10]; void phi_table()//求欧拉函数 { LL i,j,k; for(i=2;i<maxn;i++)phi[i]=0; phi[1]=1; for(i=2;i<maxn;i++) { if(!phi[i]) for(j=i;j<=maxn;j+=i) { if(!phi[j])phi[j]=j; phi[j]=phi[j]/i*(i-1); } phi[i]+=phi[i-1]; } } int main() { LL a,b; phi_table(); while(cin>>a>>b) { cout<<phi[b]-phi[a-1]<<endl; } return 0; } /* phi[i]表示前i个欧拉函数的和。 */
相关文章推荐
- HDU 1787 GCD Again/HDU 2824 The Euler function(欧拉函数模板)
- hdu 2824 The Euler function (欧拉函数离线模板)
- hdu 2824 The Euler function(欧拉函数)
- HDU 2824 The Euler function 欧拉函数
- hdu 2824 The Euler function(模板)
- HDU2824--The Euler function(欧拉函数)
- (hdu step 7.2.1)The Euler function(欧拉函数模板题——求phi[a]到phi[b]的和)
- HDU 2824 The Euler function【欧拉函数 打表】
- hdu 2824 The Euler function(欧拉函数)
- hdu 2824 The Euler function(欧拉函数)
- hdu 2824 The Euler function (欧拉函数)
- hdu-2824 The Euler function(欧拉函数)
- HDU 2824 The Euler function(欧拉函数)
- HDU 2824(The Euler function)欧拉函数
- HDU 2824 The Euler function【模板题】
- HDU 2824 The Euler function【欧拉函数入门题】
- HDU - 2824 -The Euler function【欧拉函数前缀和】
- 【HDU 2824 The Euler function】+ 欧拉函数
- HDU 2824 The Euler function(欧拉函数)
- HDU-#2824 The Euler function(欧拉函数+筛法)