ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1086. Cryptography

Accepted
Posted by Pollob Ray 30 Apr 2022 13:44
//
// Created by Ray on 4/30/2022.
//

#include <iostream>
#include <cstring>

using namespace std;

bool prime[1000000];
int primeN[15005];


void SieveOfEratosthenes(int n) {

    for (int p = 2; p * p <= n; p++) {

        if (prime[p] == true) {

            for (int i = p * p; i <= n; i += p)
                prime[i] = false;
        }
    }
    int pIndex=1;
    for (int i = 2; i <=n ; ++i)
    {
        if(prime[i])
            primeN[pIndex++]=i;
    }
}


Edited by author 30.04.2022 13:46