#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 | #64605029 | Utilizator | |
| Fișier | nrprime.cpp | Dimensiune | 626 B |
| Data încărcării | 18 Mai 2026, 11:10 | Scor/rezultat | Eroare de compilare |
nrprime.cpp: In function ‘int main()’: nrprime.cpp:8:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 8 | for(i = 1; i <= n; i++) | ^~~ nrprime.cpp:11:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 11 | for(i = 1; i <= n; i++) | ^~~ nrprime.cpp:16:12: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 16 | if(x < 2 ||(x > 2 && x % 2 ==0) | ^ nrprime.cpp:16:40: error: expected ‘;’ before ‘ok’ 16 | if(x < 2 ||(x > 2 && x % 2 ==0) | ^ | ; 17 | ok = false; | ~~ nrprime.cpp:16:18: warning: statement has no effect [-Wunused-value] 16 | if(x < 2 ||(x > 2 && x % 2 ==0) | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~ nrprime.cpp:18:12: error: expected primary-expression before ‘for’ 18 | for(d = 3; d * d <= n; d = d + 2) | ^~~ nrprime.cpp:17:23: error: expected ‘)’ before ‘for’ 17 | ok = false; | ^ | ) 18 | for(d = 3; d * d <= n; d = d + 2) | ~~~ nrprime.cpp:16:11: note: to match this ‘(’ 16 | if(x < 2 ||(x > 2 && x % 2 ==0) | ^ nrprime.cpp:16:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 16 | if(x < 2 ||(x > 2 && x % 2 ==0) | ^~ nrprime.cpp:18:23: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 18 | for(d = 3; d * d <= n; d = d + 2) | ^ nrprime.cpp:18:29: warning: statement has no effect [-Wunused-value] 18 | for(d = 3; d * d <= n; d = d + 2) | ~~~~~~^~~~ nrprime.cpp:18:44: error: expected ‘;’ before ‘)’ token 18 | for(d = 3; d * d <= n; d = d + 2) | ^ | ;
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ă.