Pagini recente » Cod sursa (job #1487409) | Cod sursa (job #2807692) | Cod sursa (job #1161057) | Cod sursa (job #1886654) | Cod sursa (job #3217616)
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(v) v.begin(), v.end()
ll ceil2(ll a, ll b) {
return (a + b - 1) / b;
}
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
void solve(){
int n;cin>>n;
bool f[2000005];
memset(f, 0, sizeof(f));
int ans=0;
for(int i=2; i<=n; i++){
if(!f[i]){
ans++;
int temp=2*i;
while(temp<=n){
f[temp]=true;
temp+=i;
}
}
}
cout<<ans;
}
int main(){
freopen("ciur.in", "r", stdin);
freopen("ciur.out", "w", stdout);
ios_base::sync_with_stdio(false); cin.tie(NULL);
// ll t;cin>>t;while(t--){solve();cout<<endl;}
solve();
}