fork download
  1. #include<stdio.h>
  2. #include<math.h>
  3. #include<string.h>
  4. typedef long long ll;
  5. ll at[1000005]={0};
  6. ll prime(ll n)
  7. {
  8. ll i,count=0;
  9. while(n%2==0)
  10. {
  11. count++;
  12. n=n/2;
  13. }
  14. at[2]=count;
  15. count=0;
  16. for(i=3;i<=sqrt(n);i=i+2)
  17. {
  18. while(n%i==0)
  19. {
  20. count++;
  21. n=n/i;
  22. }
  23. at[i]=count;
  24. count=0;
  25. }
  26. if(n>2)
  27. {
  28. count++;
  29. at[n]=count;
  30. }
  31. }
  32. int main()
  33. {
  34. ll t,n,i,k,count;
  35. ll ar[100005];
  36. scanf("%lld",&t);
  37. while(t--)
  38. {
  39. memset(at,0,sizeof(at));
  40. count=0;
  41. scanf("%lld",&n);
  42. for(i=0;i<n;i++)
  43. scanf("%lld",&ar[i]);
  44. for(i=0;i<n;i++)
  45. prime(ar[i]);
  46. for(i=0;i<=1000005;i++)
  47. if(at[i]!=0)
  48. count=count+at[i];
  49. printf("%lld\n",count);
  50. }
  51. return 0;
  52.  
  53. }
Success #stdin #stdout 0s 11936KB
stdin
Standard input is empty
stdout
Standard output is empty