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