#303
Se dau n numere naturale mai mici decât 1.000.000. Determinaţi câte dintre ele sunt prime.
| Problema | Eratostene | Operații I/O |
eratostene.in/eratostene.out
|
|---|---|---|---|
| Limita timp | 0.5 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #63531163 | Utilizator | |
| Fișier | eratostene.cpp | Dimensiune | 1.21 KB |
| Data încărcării | 07 Martie 2026, 22:10 | Scor/rezultat | Eroare de compilare |
eratostene.cpp: In instantiation of 'constexpr std::array<bool, PRIME_CHECK_CAP> compute_is_not_prime() [with unsigned int PRIME_CHECK_CAP = 100u]': eratostene.cpp:32:102: required from 'bool is_prime(int) [with unsigned int PRIME_CHECK_CAP = 100u]' eratostene.cpp:44:34: required from here eratostene.cpp:20:1: error: body of constexpr function 'constexpr std::array<bool, PRIME_CHECK_CAP> compute_is_not_prime() [with unsigned int PRIME_CHECK_CAP = 100u]' not a return-statement } ^ eratostene.cpp: In instantiation of 'bool is_prime(int) [with unsigned int PRIME_CHECK_CAP = 100u]': eratostene.cpp:44:34: required from here eratostene.cpp:32:102: error: 'constexpr std::array<bool, PRIME_CHECK_CAP> compute_is_not_prime() [with unsigned int PRIME_CHECK_CAP = 100u]' called in a constant expression static constexpr std::array<bool, PRIME_CHECK_CAP> table = compute_is_not_prime<PRIME_CHECK_CAP>(); ^ eratostene.cpp:10:45: note: 'constexpr std::array<bool, PRIME_CHECK_CAP> compute_is_not_prime() [with unsigned int PRIME_CHECK_CAP = 100u]' is not usable as a constexpr function because: constexpr std::array<bool, PRIME_CHECK_CAP> compute_is_not_prime() { ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Eratostene face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.