#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 | #63350507 | Utilizator | |
| Fișier | eratostene.cpp | Dimensiune | 513 B |
| Data încărcării | 27 Februarie 2026, 10:49 | Scor/rezultat | Eroare de compilare |
eratostene.cpp: In function 'void eratostene()': eratostene.cpp:7:29: error: array must be initialized with a brace-enclosed initializer int i,j,prim[0]=prim[1]=1; ^ eratostene.cpp:9:9: error: 'if9prim' was not declared in this scope if9prim[1]==0){ ^ eratostene.cpp:9:22: error: expected ';' before ')' token if9prim[1]==0){ ^ eratostene.cpp:7:11: warning: unused variable 'j' [-Wunused-variable] int i,j,prim[0]=prim[1]=1; ^ eratostene.cpp: In function 'int main()': eratostene.cpp:16:13: warning: statement has no effect [-Wunused-value] int n; n; cnt=0;fin>>n;eratostene(); ^ eratostene.cpp:16:15: error: 'cnt' was not declared in this scope int n; n; cnt=0;fin>>n;eratostene(); ^ eratostene.cpp:18:14: error: 'x' was not declared in this scope fin>>x; ^ eratostene.cpp:19:12: error: 'V' was not declared in this scope if(V[x]==0)cnt++; ^
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ă.