fork(1) download
  1. #include <stdio.h>
  2. #define max 1000004
  3. long int a[max]={0};
  4. void seive ()
  5. {long int i,j;
  6. for( i=2;i<max;i++)
  7.  
  8. {
  9. if(a[i]!=0)
  10. continue;
  11. for(j=2*i;j<max;j+=i)
  12. {
  13. if(a[j]==0)
  14. a[j]=i;
  15. }
  16. }
  17. }
  18. int main(void) {
  19. long int n,res,count,i,t,ac,b;
  20. seive();
  21. scanf("%ld",&t);
  22. while(t--)
  23. {count=0;
  24. res=0;
  25. scanf("%ld%ld%ld",&ac,&b,&n);
  26. for(i=ac;i<=b;i++)
  27. {count=0;
  28. if(n==1&& i==1)
  29. {
  30. count=0;
  31. if(count==n)
  32. res++;
  33. continue;
  34. }
  35.  
  36. while(a[i]!=0)
  37. {count++;
  38. while(i%a[i]==0)
  39. { if(a[i]!=0)
  40. i/=a[i];
  41. }
  42. }
  43. if(a[i]==0)
  44. count++;
  45. if(count==n)
  46. res++;
  47.  
  48. }
  49. printf("%ld\n",res);
  50.  
  51. }
  52.  
  53.  
  54.  
  55. return 0;
  56. }
Runtime error #stdin #stdout 0.02s 6152KB
stdin
1
5 6 1
stdout
Standard output is empty