Saleh127

uva 884 tle

Jun 27th, 2020
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define test int t; cin>>t; while (t--)
  4. #define ll long long int
  5. #define fellow_junior ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  6. ll a[1000002];
  7. int main()
  8. {
  9. fellow_junior
  10. ll c,d,e,f,i,j,k,l;
  11. for(i=2;i<=1000002;i++)
  12. {
  13. c=i;
  14. d=0;
  15. for(j=2;j*j<=i;j++)
  16. {
  17. if(c%j==0)
  18. {
  19. while(c%j==0)
  20. {
  21. c/=j;
  22. d++;
  23. }
  24. }
  25. }
  26. if(c>1) d++;
  27. a[i]=a[i-1]+d;
  28. }
  29. while(cin>>e && e)
  30. {
  31. cout<<a[e]<<endl;
  32. }
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment