Pagini recente » Cod sursa (job #1224910) | Cod sursa (job #2372873) | Cod sursa (job #218493) | Cod sursa (job #580125) | Cod sursa (job #668150)
Cod sursa(job #668150)
// http://infoarena.ro/problema/ciur
#include <fstream>
using namespace std;
const int MAXSIZE = 2000001;
ifstream in("ciur.in");
ofstream out("ciur.out");
int length,answer;
bool numbers[MAXSIZE];
void eratosthenes();
int main()
{
in >> length;
in.close();
int stop = length / 2;
for(int i=3;i<=length;i+=2)
if(!numbers[i])
{
for(int k=i;k<=length;k=k+(i << 1))
numbers[k] = true;
answer++;
}
out << ++answer << "\n";
out.close();
return (0);
}
void eratosthenes()
{
}