#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 | #64846317 | Utilizator | |
| Fișier | existaprime.cpp | Dimensiune | 344 B |
| Data încărcării | 06 Iunie 2026, 14:35 | Scor/rezultat | Eroare de compilare |
existaprime.cpp: In function ‘int main()’: existaprime.cpp:10:21: error: expected primary-expression before ‘;’ token 10 | for (d=1; d*d<n;; d++) | ^ existaprime.cpp:10:21: error: expected ‘)’ before ‘;’ token 10 | for (d=1; d*d<n;; d++) | ~ ^ | ) existaprime.cpp:10:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 10 | for (d=1; d*d<n;; d++) | ^~~ existaprime.cpp:10:23: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 10 | for (d=1; d*d<n;; d++) | ^ existaprime.cpp:10:26: error: expected ‘;’ before ‘)’ token 10 | for (d=1; d*d<n;; d++) | ^ | ; existaprime.cpp:16:4: error: expected ‘while’ before ‘(’ token 16 | if (v[i]%d==0) | ^ existaprime.cpp:16:15: error: expected ‘;’ before ‘cout’ 16 | if (v[i]%d==0) | ^ | ; 17 | cout << "DA"; | ~~~~ existaprime.cpp:18:1: error: ‘else’ without a previous ‘if’ 18 | else cout << "NU"; | ^~~~ existaprime.cpp:4:24: warning: unused variable ‘aux’ [-Wunused-variable] 4 | int v[1005], n, i, ok, aux, d, ndiv; | ^~~
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ă.