Cod sursa(job #3362991)

Utilizator CorvinJudge0Corvin Judge CorvinJudge0 Data 13 august 2026 12:10:36
Problema Ciurul lui Eratosthenes Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.42 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin(" ciur.in ");
ofstream fout(" ciur.out ");
int main()
{

 long long  n , nr=0;
 fin>>n;
 bool ciur[n];



 ciur[0]=ciur[1]=1;

 for(int  i = 2 ; i < n ; i++)
  {
      if(ciur[i] == 0){


          for(int j = i * 2 ; j < n  ; j += i)
          {
             ciur[j]=1;

          }
       nr = nr + 1;

      }


  }


 fout<<nr;







    return 0;
}