#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 | #64073772 | Utilizator | |
| Fișier | eratostene.cpp | Dimensiune | 412 B |
| Data încărcării | 15 Aprilie 2026, 17:21 | Scor/rezultat | Eroare de compilare |
eratostene.cpp: In function ‘int main()’: eratostene.cpp:11:35: error: expected ‘;’ before ‘for’ 11 | for (i=1; i<=n; i++) fin>>v[i] | ^ | ; 12 | for (h=1; h<=n; h++) for (i=2; i<=sqrt(n); i++) if (v[i]==0) for (j=i; j<=n/i; j++) v[i*j]=1; | ~~~ eratostene.cpp:12:16: warning: statement has no effect [-Wunused-value] 12 | for (h=1; h<=n; h++) for (i=2; i<=sqrt(n); i++) if (v[i]==0) for (j=i; j<=n/i; j++) v[i*j]=1; | ~^~~ eratostene.cpp:12:24: error: expected ‘;’ before ‘)’ token 12 | for (h=1; h<=n; h++) for (i=2; i<=sqrt(n); i++) if (v[i]==0) for (j=i; j<=n/i; j++) v[i*j]=1; | ^ | ; eratostene.cpp:12:37: warning: value computed is not used [-Wunused-value] 12 | for (h=1; h<=n; h++) for (i=2; i<=sqrt(n); i++) if (v[i]==0) for (j=i; j<=n/i; j++) v[i*j]=1; | ~^~~~~~~~~ eratostene.cpp:12:51: error: expected ‘;’ before ‘)’ token 12 | for (h=1; h<=n; h++) for (i=2; i<=sqrt(n); i++) if (v[i]==0) for (j=i; j<=n/i; j++) v[i*j]=1; | ^ | ; eratostene.cpp:12:77: warning: statement has no effect [-Wunused-value] 12 | for (h=1; h<=n; h++) for (i=2; i<=sqrt(n); i++) if (v[i]==0) for (j=i; j<=n/i; j++) v[i*j]=1; | ~^~~~~ eratostene.cpp:12:87: error: expected ‘;’ before ‘)’ token 12 | for (h=1; h<=n; h++) for (i=2; i<=sqrt(n); i++) if (v[i]==0) for (j=i; j<=n/i; j++) v[i*j]=1; | ^ | ;
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ă.