#506
Se dă un şir cu n elemente, numere naturale. Să se verifice dacă în șir există elemente prime.
| Problema | ExistaPrime | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64942087 | Utilizator | |
| Fișier | existaprime.cpp | Dimensiune | 259 B |
| Data încărcării | 18 Iunie 2026, 22:20 | Scor/rezultat | Eroare de compilare |
existaprime.cpp: In function ‘int main()’: existaprime.cpp:12:6: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 12 | if(int i=2;i*i<x;i++) | ^~~ existaprime.cpp:12:19: error: expected ‘)’ before ‘;’ token 12 | if(int i=2;i*i<x;i++) | ~ ^ | ) existaprime.cpp:12:3: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 12 | if(int i=2;i*i<x;i++) | ^~ existaprime.cpp:12:20: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 12 | if(int i=2;i*i<x;i++) | ^ existaprime.cpp:12:20: error: ‘i’ was not declared in this scope
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema ExistaPrime 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ă.