Facebook
From TOMMY, 1 Month ago, written in C++.
Embed
Download Paste or View Raw
Hits: 130
  1. #include<bits/stdc++.h>
  2. #define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  3. #define file freopen("BEAUNUM.inp","r",stdin);freopen("BEAUNUM.out","w",stdout);
  4. using namespace std;
  5. int main(){
  6.  file;
  7.  long long n,e=0,kq=0,bien=0;
  8.  bool ktra[100000];
  9.  memset(ktra,true,sizeof(ktra));
  10.  ktra[0]=ktra[1]=false;
  11.  for(int i=2;i*i<=1e5+5;i++)
  12.   if (ktra[i])
  13.    for (int j=i*i;j<=n;j+=i)
  14.     ktra[j]=false;
  15.  cin>>n;
  16.  while (bien<n){
  17.   e++;
  18.   if (ktra[e]){
  19.    bien=e*e*e*e;
  20.    kq++;
  21.   }
  22.  }
  23.  if (bien>n) kq--;
  24.  cout<<kq;
  25.  return 0;
  26. }