Advertisement
Saleh127

spoj cuve free

Aug 14th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. bool cd[1000008];
  5. ll a[1000008]={0};
  6. void cuve()
  7. {
  8. ll i,j,k,l,m;
  9. for(i=2;i<101;i++)
  10. {
  11. j=i*i*i;
  12. for(k=j;k<1000008;k+=j)
  13. {
  14. cd[k]=true;
  15. }
  16. }
  17. m=0;
  18. for(i=1;i<1000008;i++)
  19. {
  20. if(cd[i]==false)
  21. {
  22. m++;
  23. a[i]=m;
  24. }
  25. }
  26. }
  27. int main()
  28. {
  29. ios_base::sync_with_stdio(0);
  30. cin.tie(0);cout.tie(0);
  31.  
  32. cuve();
  33. ll t,c,i,j;
  34. cin>>t;
  35. for(i=1;i<=t;i++)
  36. {
  37. cin>>c;
  38. cout<<"Case "<<i<<": ";
  39. if(a[c]==0) cout<<"Not Cube Free"<<endl;
  40. else cout<<a[c]<<endl;
  41. }
  42.  
  43. return 0;
  44. }
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement