#1508
Element_SA
C++
Să se scrie o funcție C++ care are ca parametri două numere naturale n
și m
și o matrice A(n , m)
avȃnd elemente numere întregi și returnează numărul de elemente „șa” din matrice. Un element A(i,j)
din matrice se numește element „șa” dacă este maximul de pe coloana j
si minimul de pe linia i
sau invers.
Admitere Mate-Info UBB, iulie 2015
Problema | Element_SA | Operații I/O |
![]() |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #58583665 | Utilizator | |
Fișier | element_sa.cpp | Dimensiune | 609 B |
Data încărcării | 24 Iunie 2025, 15:46 | Scor / rezultat | Eroare de compilare |
element_sa.cpp: In function 'int nr_sa(int (*)[100], int, int)': element_sa.cpp:10:33: error: 'mat' was not declared in this scope lmin=lmax=cmin=cmax=mat[i][j]; ^ element_sa.cpp:16:44: error: 'l' was not declared in this scope if(a[k][j]<cmin){cmin=a[k][l];} ^ element_sa.cpp:17:44: error: 'l' was not declared in this scope if(a[k][j]>cmax){cmax=a[k][l];} ^ element_sa.cpp:20:10: error: 'lmin' was not declared in this scope if( (lmin==a[i][j] && cmax==a[i][j] || lmax==a[i][j] && cmin==mat[i][j])){sa++;} ^ element_sa.cpp:20:21: error: 'j' was not declared in this scope if( (lmin==a[i][j] && cmax==a[i][j] || lmax==a[i][j] && cmin==mat[i][j])){sa++;} ^ element_sa.cpp:20:27: error: 'cmax' was not declared in this scope if( (lmin==a[i][j] && cmax==a[i][j] || lmax==a[i][j] && cmin==mat[i][j])){sa++;} ^ element_sa.cpp:20:45: error: 'lmax' was not declared in this scope if( (lmin==a[i][j] && cmax==a[i][j] || lmax==a[i][j] && cmin==mat[i][j])){sa++;} ^ element_sa.cpp:20:62: error: 'cmin' was not declared in this scope if( (lmin==a[i][j] && cmax==a[i][j] || lmax==a[i][j] && cmin==mat[i][j])){sa++;} ^ element_sa.cpp:20:68: error: 'mat' was not declared in this scope if( (lmin==a[i][j] && cmax==a[i][j] || lmax==a[i][j] && cmin==mat[i][j])){sa++;} ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Element_SA face parte din a doua categorie. Pentru aceste probleme se folosește un program suport, furnizat de propunătorul problemei. 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ă.