#346
Să se scrie un program care citește un șir de n numere naturale şi determină valoarea maximă din șir și de câte ori apare.
| Problema | MaxAndAp | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64156635 | Utilizator | |
| Fișier | maxandap.cpp | Dimensiune | 272 B |
| Data încărcării | 20 Aprilie 2026, 20:47 | Scor/rezultat | Eroare de compilare |
maxandap.cpp: In function ‘int main()’: maxandap.cpp:7:16: error: expected primary-expression before ‘)’ token 7 | for (max=0;) | ^ maxandap.cpp:7:16: error: expected ‘;’ before ‘)’ token 7 | for (max=0;) | ^ | ; maxandap.cpp:8:10: error: expected ‘)’ before ‘;’ token 8 | (ap=0;) | ~ ^ | ) maxandap.cpp:7:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 7 | for (max=0;) | ^~~ maxandap.cpp:8:11: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 8 | (ap=0;) | ^ maxandap.cpp:8:11: error: expected primary-expression before ‘)’ token maxandap.cpp:9:11: error: expected primary-expression before ‘)’ token 9 | (1,n;){ | ^ maxandap.cpp: At global scope: maxandap.cpp:16:5: error: expected unqualified-id before ‘return’ 16 | return 0; | ^~~~~~ maxandap.cpp:17:1: error: expected declaration before ‘}’ token 17 | } | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema MaxAndAp 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ă.