#4279
Se citesc de la tastatură numerele n k, apoi n numere naturale. Să se determine suma celor impare și câte dintre ele se divid cu k.
| Problema | SumCnt2 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64818239 | Utilizator | |
| Fișier | sumcnt2.cpp | Dimensiune | 288 B |
| Data încărcării | 03 Iunie 2026, 13:10 | Scor/rezultat | Eroare de compilare |
sumcnt2.cpp:3:15: error: ‘nr’ does not name a type 3 | int n,k,s,c,i;nr; | ^~ sumcnt2.cpp: In function ‘int main()’: sumcnt2.cpp:9:12: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 9 | if(i=1;i<=n;i++) | ^ sumcnt2.cpp:9:20: error: expected ‘)’ before ‘;’ token 9 | if(i=1;i<=n;i++) | ~ ^ | ) sumcnt2.cpp:9:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 9 | if(i=1;i<=n;i++) | ^~ sumcnt2.cpp:9:21: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 9 | if(i=1;i<=n;i++) | ^ sumcnt2.cpp:9:24: error: expected ‘;’ before ‘)’ token 9 | if(i=1;i<=n;i++) | ^ | ; sumcnt2.cpp:11:12: error: ‘nr’ was not declared in this scope; did you mean ‘n’? 11 | if(nr%2!=0) | ^~ | n sumcnt2.cpp:13:12: error: ‘nr’ was not declared in this scope; did you mean ‘n’? 13 | if(nr%k==0) | ^~ | n sumcnt2.cpp:16:9: error: ‘o’ was not declared in this scope 16 | return o; | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema SumCnt2 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ă.