Pagini recente » Cod sursa (job #829) | Cod sursa (job #2875548) | Cod sursa (job #175831) | Cod sursa (job #866484) | Cod sursa (job #3217614)
#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(){
ll n;cin>>n;
int f[n+1];
memset(f,0,sizeof(f));
ll ans=0;
for(int i=2; i<=n; i++){
if(!f[i]){
ans++;
ll temp=2*i;
while(temp<=n){
f[temp]++;
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();
}