#666
Se dă o matrice cu n linii și m coloane și elemente numere naturale. Să se determine câte dintre elementele situate pe linii cu indici pari sunt prime.
| Problema | NrPrime | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64487556 | Utilizator | |
| Fișier | nrprime.cpp | Dimensiune | 748 B |
| Data încărcării | 10 Mai 2026, 18:52 | Scor/rezultat | Eroare de compilare |
nrprime.cpp: In function ‘int main()’: nrprime.cpp:15:9: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 15 | for (int j = 1; j <= m; j++) | ^~~ nrprime.cpp:17:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 17 | int nr_div = 0; | ^~~ nrprime.cpp:16:17: warning: unused variable ‘x’ [-Wunused-variable] 16 | int x = a[i][j]; | ^ nrprime.cpp:19:17: error: ‘x’ was not declared in this scope 19 | if (x <2 ) | ^ nrprime.cpp:20:27: error: expected ‘;’ before ‘for’ 20 | nr_div = 1 | ^ | ; 21 | 22 | for (int d = 2; d <= x / 2; d++) { | ~~~ nrprime.cpp:22:29: error: ‘d’ was not declared in this scope 22 | for (int d = 2; d <= x / 2; d++) { | ^ nrprime.cpp:22:34: error: ‘x’ was not declared in this scope 22 | for (int d = 2; d <= x / 2; d++) { | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema NrPrime 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ă.