Cod sursa(job #2019113)
Utilizator | Data | 6 septembrie 2017 23:10:31 | |
---|---|---|---|
Problema | Ciurul lui Eratosthenes | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.33 kb |
#include <bits/stdc++.h>
using namespace std;
bitset <2000004> fv;
int main(int argc, char const *argv[])
{
ifstream fin ("ciur.in");
ofstream fout ("ciur.out");
int n;
fin >> n;
int ans = 0;
for (int i = 2; i<=n; ++i)
if (vf[i] == 0)
{
++ans;
for (int j = i+i; j<=n; j+=i)
fv[j] = 1;
}
fout << ans;
return 0;
}