#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 | #47275889 | Utilizator | |
Fișier | element_sa.cpp | Dimensiune | 900 B |
Data încărcării | 08 Decembrie 2023, 08:52 | Scor / rezultat | Eroare de compilare |
element_sa.cpp:9:32: error: use of parameter outside function body before ']' token int nr_sa(int n, int m, int a[n][m]){ ^ element_sa.cpp:9:35: error: use of parameter outside function body before ']' token int nr_sa(int n, int m, int a[n][m]){ ^ element_sa.cpp: In function 'int nr_sa(...)': element_sa.cpp:10:21: error: 'n' was not declared in this scope int k=0, i, j, maxl(n), minl(n), maxc(m), minc(m); ^ element_sa.cpp:10:39: error: 'm' was not declared in this scope int k=0, i, j, maxl(n), minl(n), maxc(m), minc(m); ^ element_sa.cpp:13:11: error: 'a' was not declared in this scope if(a[i][j]<=a[i+1][j]) ^ element_sa.cpp:14:16: error: 'minl' cannot be used as a function minl(i)=a[i][j]; ^ element_sa.cpp:15:12: error: 'a' was not declared in this scope if(a[i][j]>=a[i+1][j]) ^ element_sa.cpp:16:16: error: 'maxl' cannot be used as a function maxl(i)=a[i][j]; ^ element_sa.cpp:21:11: error: 'a' was not declared in this scope if(a[i][j]<=a[i][j+1]) ^ element_sa.cpp:22:16: error: 'minc' cannot be used as a function minc(j)=a[i][j]; ^ element_sa.cpp:23:12: error: 'a' was not declared in this scope if(a[i][j]>=a[i][j+1]) ^ element_sa.cpp:24:16: error: 'maxc' cannot be used as a function maxc(j)=a[i][j]; ^ element_sa.cpp:29:11: error: 'a' was not declared in this scope if(a[i][j]=maxl(i)&&a[i][j]=minc(j) || a[i][j]=minl(i)&&a[i][j]=maxc(j)) ^ element_sa.cpp:29:25: error: 'maxl' cannot be used as a function if(a[i][j]=maxl(i)&&a[i][j]=minc(j) || a[i][j]=minl(i)&&a[i][j]=maxc(j)) ^ element_sa.cpp:29:42: error: 'minc' cannot be used as a function if(a[i][j]=maxl(i)&&a[i][j]=minc(j) || a[i][j]=minl(i)&&a[i][j]=maxc(j)) ^ element_sa.cpp:29:61: error: 'minl' cannot be used as a function if(a[i][j]=maxl(i)&&a[i][j]=minc(j) || a[i][j]=minl(i)&&a[i][j]=maxc(j)) ^ element_sa.cpp:29:78: error: 'maxc' cannot be used as a function if(a[i][j]=maxl(i)&&a[i][j]=minc(j) || a[i][j]=minl(i)&&a[i][j]=maxc(j)) ^ element_sa.cpp: In function 'int main()': element_sa.cpp:45:5: error: expected ';' before 'return' return 0; ^ element_sa.cpp: In function 'int main()': element_sa.cpp:48:5: error: redefinition of 'int main()' int main(){ ^ element_sa.cpp:35:5: error: 'int main()' previously defined here int main() ^
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ă.