what's worng in my code..........why the judge is giving
TLE.............plzz help me out
my code is
# include<stdio.h>
int main()
{
long long int phi[1000001];
long long int n=1000000,k,i,j;
phi[1]=1;
for ( i=2; i<=n; ++i) phi[i]=i;
for ( i=2; i<=n; ++i)
if (phi[i]==i) // prime
for ( j=i; j<=n; j+=i)
phi[j]=phi[j]/i*(i-1);
int t;
scanf("%d",&t);
while(t--)
{
scanf("%lld",&k);
printf("%lld",phi[k]);
}
return 0;
}
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.