F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_20613333_25366.cpp:5:46: error: stray '#' in program
     using namespace std;typedef long long LL;#define maxn 1000010int phi[maxn]; int prime[maxn],cnt; bool flag[maxn]; int p[100],num; LL ans,l;  void init(){       cnt=0;    memset(flag,0,sizeof(flag));    for(int i=2;i<maxn;i++)      if(!flag[i])      {          prime[cnt++]=i;          for(int j=i+i;j<maxn;j+=i)              flag[j]=1;      }    for(int i=0;i<maxn;i++) phi[i]=i;    for(int i=2;i<maxn;i+=2) phi[i]>>=1;    for(int i=3;i<maxn;i+=2)      if(phi[i]==i)        for(int j=i;j<maxn;j+=i)          phi[j]=phi[j]-phi[j]/i;} void divide(int x){    num=0;    for(int i=0;i<cnt&&prime[i]*prime[i]<=x;i++)      if(x%prime[i]==0)      {          p[num++]=prime[i];          while(x%prime[i]==0) x/=prime[i];      }    if(x>1) p[num++]=x;} void dfs(int id,int mul,int tot,int x){    if(id==num)    {        if(tot&1) ans=ans-x/mul;        else ans=ans+x/mul;        return ;    }    dfs(id+1,mul*p[id],tot+1,x);    dfs(id+1,mul,tot,x);} int main(){    init();    int t;    cin>>t;    while(t--)    {        scanf("%lld",&l);        int temp=sqrt(l+0.0);        ans=0;        for(int i=1;i<=temp;i++)         {            int lim=sqrt(l-(LL)i*i+0.0);              if(i&1)             {                divide(i);                if(i<=lim) dfs(0,1,0,i>>1);                else dfs(0,1,0,lim>>1);            }            else             {                if(i<=lim) ans+=phi[i];                else                {                    divide(i);                    dfs(0,1,0,lim);                }            }        }        printf("%lld\n",ans);    }    return 0;}
                                              ^
0_0_20613333_25366.cpp:5:47: error: 'define' does not name a type
     using namespace std;typedef long long LL;#define maxn 1000010int phi[maxn]; int prime[maxn],cnt; bool flag[maxn]; int p[100],num; LL ans,l;  void init(){       cnt=0;    memset(flag,0,sizeof(flag));    for(int i=2;i<maxn;i++)      if(!flag[i])      {          prime[cnt++]=i;          for(int j=i+i;j<maxn;j+=i)              flag[j]=1;      }    for(int i=0;i<maxn;i++) phi[i]=i;    for(int i=2;i<maxn;i+=2) phi[i]>>=1;    for(int i=3;i<maxn;i+=2)      if(phi[i]==i)        for(int j=i;j<maxn;j+=i)          phi[j]=phi[j]-phi[j]/i;} void divide(int x){    num=0;    for(int i=0;i<cnt&&prime[i]*prime[i]<=x;i++)      if(x%prime[i]==0)      {          p[num++]=prime[i];          while(x%prime[i]==0) x/=prime[i];      }    if(x>1) p[num++]=x;} void dfs(int id,int mul,int tot,int x){    if(id==num)    {        if(tot&1) ans=ans-x/mul;        else ans=ans+x/mul;        return ;    }    dfs(id+1,mul*p[id],tot+1,x);    dfs(id+1,mul,tot,x);} int main(){    init();    int t;    cin>>t;    while(t--)    {        scanf("%lld",&l);        int temp=sqrt(l+0.0);        ans=0;        for(int i=1;i<=temp;i++)         {            int lim=sqrt(l-(LL)i*i+0.0);              if(i&1)             {                divide(i);                if(i<=lim) dfs(0,1,0,i>>1);                else dfs(0,1,0,lim>>1);            }            else             {                if(i<=lim) ans+=phi[i];                else                {                    divide(i);                    dfs(0,1,0,lim);                }            }        }        printf("%lld\n",ans);    }    return 0;}
                                               ^
0_0_20613333_25366.cpp:5:91: error: 'maxn' was not declared in this scope
     using namespace std;typedef long long LL;#define maxn 1000010int phi[maxn]; int prime[maxn],cnt; bool flag[maxn]; int p[100],num; LL ans,l;  void init(){       cnt=0;    memset(flag,0,sizeof(flag));    for(int i=2;i<maxn;i++)      if(!flag[i])      {          prime[cnt++]=i;          for(int j=i+i;j<maxn;j+=i)              flag[j]=1;      }    for(int i=0;i<maxn;i++) phi[i]=i;    for(int i=2;i<maxn;i+=2) phi[i]>>=1;    for(int i=3;i<maxn;i+=2)      if(phi[i]==i)        for(int j=i;j<maxn;j+=i)          phi[j]=phi[j]-phi[j]/i;} void divide(int x){    num=0;    for(int i=0;i<cnt&&prime[i]*prime[i]<=x;i++)      if(x%prime[i]==0)      {          p[num++]=prime[i];          while(x%prime[i]==0) x/=prime[i];      }    if(x>1) p[num++]=x;} void dfs(int id,int mul,int tot,int x){    if(id==num)    {        if(tot&1) ans=ans-x/mul;        else ans=ans+x/mul;        return ;    }    dfs(id+1,mul*p[id],tot+1,x);    dfs(id+1,mul,tot,x);} int main(){    init();    int t;    cin>>t;    while(t--)    {        scanf("%lld",&l);        int temp=sqrt(l+0.0);        ans=0;        for(int i=1;i<=temp;i++)         {            int lim=sqrt(l-(LL)i*i+0.0);              if(i&1)             {                divide(i);                if(i<=lim) dfs(0,1,0,i>>1);                else dfs(0,1,0,lim>>1);            }            else             {                if(i<=lim) ans+=phi[i];                else                {                    divide(i);                    dfs(0,1,0,lim);                }            }        }        printf("%lld\n",ans);    }    return 0;}
                                                                                           ^
0_0_20613333_25366.cpp:5:112: error: 'maxn' was not declared in this scope
     using namespace std;typedef long long LL;#define maxn 1000010int phi[maxn]; int prime[maxn],cnt; bool flag[maxn]; int p[100],num; LL ans,l;  void init(){       cnt=0;    memset(flag,0,sizeof(flag));    for(int i=2;i<maxn;i++)      if(!flag[i])      {          prime[cnt++]=i;          for(int j=i+i;j<maxn;j+=i)              flag[j]=1;      }    for(int i=0;i<maxn;i++) phi[i]=i;    for(int i=2;i<maxn;i+=2) phi[i]>>=1;    for(int i=3;i<maxn;i+=2)      if(phi[i]==i)        for(int j=i;j<maxn;j+=i)          phi[j]=phi[j]-phi[j]/i;} void divide(int x){    num=0;    for(int i=0;i<cnt&&prime[i]*prime[i]<=x;i++)      if(x%prime[i]==0)      {          p[num++]=prime[i];          while(x%prime[i]==0) x/=prime[i];      }    if(x>1) p[num++]=x;} void dfs(int id,int mul,int tot,int x){    if(id==num)    {        if(tot&1) ans=ans-x/mul;        else ans=ans+x/mul;        return ;    }    dfs(id+1,mul*p[id],tot+1,x);    dfs(id+1,mul,tot,x);} int main(){    init();    int t;    cin>>t;    while(t--)    {        scanf("%lld",&l);        int temp=sqrt(l+0.0);        ans=0;        for(int i=1;i<=temp;i++)         {            int lim=sqrt(l-(LL)i*i+0.0);              if(i&1)             {                divide(i);                if(i<=lim) dfs(0,1,0,i>>1);                else dfs(0,1,0,lim>>1);            }            else             {                if(i<=lim) ans+=phi[i];                else                {                    divide(i);                    dfs(0,1,0,lim);                }            }        }        printf("%lld\n",ans);    }    return 0;}
                                                                                                                ^
0_0_20613333_25366.cpp: In function 'void init()':
0_0_20613333_25366.cpp:5:182: error: 'flag' was not declared in this scope
     using namespace std;typedef long long LL;#define maxn 1000010int phi[maxn]; int prime[maxn],cnt; bool flag[maxn]; int p[100],num; LL ans,l;  void init(){       cnt=0;    memset(flag,0,sizeof(flag));    for(int i=2;i<maxn;i++)      if(!flag[i])      {          prime[cnt++]=i;          for(int j=i+i;j<maxn;j+=i)              flag[j]=1;      }    for(int i=0;i<maxn;i++) phi[i]=i;    for(int i=2;i<maxn;i+=2) phi[i]>>=1;    for(int i=3;i<maxn;i+=2)      if(phi[i]==i)        for(int j=i;j<maxn;j+=i)          phi[j]=phi[j]-phi[j]/i;} void divide(int x){    num=0;    for(int i=0;i<cnt&&prime[i]*prime[i]<=x;i++)      if(x%prime[i]==0)      {          p[num++]=prime[i];          while(x%prime[i]==0) x/=prime[i];      }    if(x>1) p[num++]=x;} void dfs(int id,int mul,int tot,int x){    if(id==num)    {        if(tot&1) ans=ans-x/mul;        else ans=ans+x/mul;        return ;    }    dfs(id+1,mul*p[id],tot+1,x);    dfs(id+1,mul,tot,x);} int main(){    init();    int t;    cin>>t;    while(t--)    {        scanf("%lld",&l);        int temp=sqrt(l+0.0);        ans=0;        for(int i=1;i<=temp;i++)         {            int lim=sqrt(l-(LL)i*i+0.0);              if(i&1)             {                divide(i);                if(i<=lim) dfs(0,1,0,i>>1);                else dfs(0,1,0,lim>>1);            }            else             {                if(i<=lim) ans+=phi[i];                else                {                    divide(i);                    dfs(0,1,0,lim);                }            }        }        printf("%lld\n",ans);    }    return 0;}
                                                                                                                                                                                      ^
0_0_20613333_25366.cpp:5:221: error: 'maxn' was not declared in this scope
     using namespace std;typedef long long LL;#define maxn 1000010int phi[maxn]; int prime[maxn],cnt; bool flag[maxn]; int p[100],num; LL ans,l;  void init(){       cnt=0;    memset(flag,0,sizeof(flag));    for(int i=2;i<maxn;i++)      if(!flag[i])      {          prime[cnt++]=i;          for(int j=i+i;j<maxn;j+=i)              flag[j]=1;      }    for(int i=0;i<maxn;i++) phi[i]=i;    for(int i=2;i<maxn;i+=2) phi[i]>>=1;    for(int i=3;i<maxn;i+=2)      if(phi[i]==i)        for(int j=i;j<maxn;j+=i)          phi[j]=phi[j]-phi[j]/i;} void divide(int x){    num=0;    for(int i=0;i<cnt&&prime[i]*prime[i]<=x;i++)      if(x%prime[i]==0)      {          p[num++]=prime[i];          while(x%prime[i]==0) x/=prime[i];      }    if(x>1) p[num++]=x;} void dfs(int id,int mul,int tot,int x){    if(id==num)    {        if(tot&1) ans=ans-x/mul;        else ans=ans+x/mul;        return ;    }    dfs(id+1,mul*p[id],tot+1,x);    dfs(id+1,mul,tot,x);} int main(){    init();    int t;    cin>>t;    while(t--)    {        scanf("%lld",&l);        int temp=sqrt(l+0.0);        ans=0;        for(int i=1;i<=temp;i++)         {            int lim=sqrt(l-(LL)i*i+0.0);              if(i&1)             {                divide(i);                if(i<=lim) dfs(0,1,0,i>>1);                else dfs(0,1,0,lim>>1);            }            else             {   


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-06-29 16:32:53, Gzip enabled