#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 | #64630207 | Utilizator | |
| Fișier | existaprime.cpp | Dimensiune | 549 B |
| Data încărcării | 19 Mai 2026, 12:58 | Scor/rezultat | Eroare de compilare |
existaprime.cpp: In function ‘int main()’: existaprime.cpp:5:21: error: a function-definition is not allowed here before ‘{’ token 5 | bool prim(int x){ | ^ existaprime.cpp:13:13: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 13 | }int min(); | ^~ existaprime.cpp:13:13: note: remove parentheses to default-initialize a variable 13 | }int min(); | ^~ | -- existaprime.cpp:13:13: note: or replace parentheses with braces to value-initialize a variable existaprime.cpp:17:1: error: expected ‘,’ or ‘;’ before ‘cin’ 17 | cin>>n; | ^~~ existaprime.cpp:20:12: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 20 | if(prim(x) | ^~~~ existaprime.cpp:20:12: error: ‘prim’ was not declared in this scope existaprime.cpp:22:12: error: expected primary-expression before ‘}’ token 22 | } | ^ existaprime.cpp:21:23: error: expected ‘)’ before ‘}’ token 21 | exite=true; | ^ | ) 22 | } | ~ existaprime.cpp:20:11: note: to match this ‘(’ 20 | if(prim(x) | ^ existaprime.cpp:22:12: error: expected primary-expression before ‘}’ token 22 | } | ^
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ă.