Facebook
From tranhuumanh, 1 Month ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 138
  1. #include<bits/stdc++.h>
  2. //giatri
  3.  long long n,e=0,kq=0,bien=0;
  4.  bool ktra[100000];
  5. //giatri
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.  ios_base::sync_with_stdio(false);
  11.  cin.tie(NULL);
  12.  cout.tie(NULL);
  13.  
  14. freopen("BEAUNUM.inp","r",stdin);
  15. freopen("BEAUNUM.out","w",stdout);
  16.    memset(ktra,true,sizeof(ktra));
  17.  ktra[0]=ktra[1]=false;
  18.  for(int i=2;i*i<=1e5+5;i++)
  19.  {
  20.   if (ktra[i])
  21.    for (int j=i*i;j<=1e5+5;j+=i)
  22.    {
  23.     ktra[j]=false;
  24. }
  25.   }
  26.  cin>>n;
  27.  
  28.  
  29.  while (bien<n)
  30.  {
  31.   e++;
  32.   if (ktra[e])
  33.   {
  34.    bien=e*e*e*e;
  35.    kq++;
  36.   }
  37.  }
  38.  if (bien>n)
  39.  {
  40.  kq--;
  41.  }
  42.  
  43.  
  44.  cout<<kq;
  45.  
  46.  
  47.  return 0;
  48. }