#773
Se dă o matrice cu n linii şi m coloane şi elemente numere naturale. Să se determine elementul cu număr maxim de apariții în matrice. Dacă există mai multe elemente cu număr maxim de apariții se va afișa cel mai mare dintre ele.
| Problema | MaxAp1 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64564800 | Utilizator | |
| Fișier | maxap1.cpp | Dimensiune | 521 B |
| Data încărcării | 14 Mai 2026, 15:02 | Scor/rezultat | Eroare de compilare |
maxap1.cpp: In function ‘int main()’: maxap1.cpp:8:2: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 8 | for(i=1;i<=n;i++) | ^~~ maxap1.cpp:11:6: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 11 | int maxim=0, ap=0; | ^~~ maxap1.cpp:14:9: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 14 | if(maxim<a[i][j] | ^~~~~ maxap1.cpp:14:22: error: expected ‘;’ before ‘maxim’ 14 | if(maxim<a[i][j] | ^ | ; 15 | maxim = a[i][j];} | ~~~~~ maxap1.cpp:14:14: warning: statement has no effect [-Wunused-value] 14 | if(maxim<a[i][j] | ~~~~~^~~~~~~~ maxap1.cpp:15:25: error: expected primary-expression before ‘}’ token 15 | maxim = a[i][j];} | ^ maxap1.cpp:15:25: error: expected ‘)’ before ‘}’ token 15 | maxim = a[i][j];} | ^ | ) maxap1.cpp:14:8: note: to match this ‘(’ 14 | if(maxim<a[i][j] | ^ maxap1.cpp:15:25: error: expected primary-expression before ‘}’ token 15 | maxim = a[i][j];} | ^ maxap1.cpp:22:13: warning: unused variable ‘p’ [-Wunused-variable] 22 | int p=i,ok=0;} | ^ maxap1.cpp:22:17: warning: unused variable ‘ok’ [-Wunused-variable] 22 | int p=i,ok=0;} | ^~ maxap1.cpp:23:15: error: ‘p’ was not declared in this scope; did you mean ‘ap’? 23 | cout<<p; | ^ | ap
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema MaxAp1 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ă.