Cod sursa(job #2641164)

Utilizator dream3rDavid Pop dream3r Data 10 august 2020 13:03:02
Problema Ciurul lui Eratosthenes Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.46 kb
//#include "pch.h"
#include <iostream>
#include <vector>
#include <fstream>
#include <algorithm>
#define nmax 2000005
using namespace std;
ifstream f("ciur.in");
ofstream o("ciur.out");

bool v[nmax];
int n;
int cite;
void ciur()
{
	for (size_t i = 2; i <= n; i++)
	{
		if (v[i] == false)
		{
			cite++;
			for (size_t j = 2 * i; j <= n; j += i)
			{
				v[j] = true;
			}
		}



	}
}

int main()
{
	f >> n;
	ciur();

	o << cite;


}