#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 | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #49944798 | Utilizator | |
Fișier | element_sa.cpp | Dimensiune | 926 B |
Data încărcării | 20 Martie 2024, 18:14 | Scor / rezultat | Eroare de compilare |
element_sa.cpp: In function 'int nr_sa(int, int, int (*)[101])': element_sa.cpp:8:33: error: redeclaration of 'int maxl' int maxl(101),minc(101),maxl(101),minl(101); ^ element_sa.cpp:8:9: error: 'int maxl' previously declared here int maxl(101),minc(101),maxl(101),minl(101); ^ element_sa.cpp:11:14: error: 'INT_MAX' was not declared in this scope int minn=INT_MAX; ^ element_sa.cpp:12:14: error: 'INT_MINN' was not declared in this scope int maxx=INT_MINN; ^ element_sa.cpp:20:11: error: 'minl' cannot be used as a function minl(i)=minn; ^ element_sa.cpp:21:11: error: 'maxl' cannot be used as a function maxl(i)=maxx; ^ element_sa.cpp:27:6: error: 'minn' was not declared in this scope minn=INT_MAX; ^ element_sa.cpp:27:11: error: 'INT_MAX' was not declared in this scope minn=INT_MAX; ^ element_sa.cpp:28:6: error: 'maxx' was not declared in this scope maxx=INT_MINN; ^ element_sa.cpp:28:11: error: 'INT_MINN' was not declared in this scope maxx=INT_MINN; ^ element_sa.cpp:36:11: error: 'minc' cannot be used as a function minc(j)=minn; ^ element_sa.cpp:37:11: error: 'maxc' was not declared in this scope maxc(j)=maxx; ^ element_sa.cpp:44:27: error: 'minl' cannot be used as a function if(a[i][j]==minl(i) && a[i][j]==maxc(j)) ^ element_sa.cpp:44:47: error: 'maxc' was not declared in this scope if(a[i][j]==minl(i) && a[i][j]==maxc(j)) ^ element_sa.cpp:45:13: error: 'nr' was not declared in this scope nr++; ^ element_sa.cpp:46:27: error: 'minc' cannot be used as a function if(a[i][j]==minc(j) && a[i][j]==maxl(i)) ^ element_sa.cpp:46:47: error: 'maxl' cannot be used as a function if(a[i][j]==minc(j) && a[i][j]==maxl(i)) ^ element_sa.cpp:47:13: error: 'nr' was not declared in this scope nr++; ^ element_sa.cpp:49:12: error: 'nr' was not declared in this scope return nr; ^ element_sa.cpp: In function 'int main()': element_sa.cpp:60:24: error: invalid conversion from 'int (*)[100]' to 'int' [-fpermissive] cout << nr_sa(a,n,m); ^ element_sa.cpp:6:5: error: initializing argument 1 of 'int nr_sa(int, int, int (*)[101])' [-fpermissive] int nr_sa(int n, int m,int a[101][101]) ^ element_sa.cpp:60:24: error: invalid conversion from 'int' to 'int (*)[101]' [-fpermissive] cout << nr_sa(a,n,m); ^ element_sa.cpp:6:5: error: initializing argument 3 of 'int nr_sa(int, int, int (*)[101])' [-fpermissive] int nr_sa(int n, int m,int a[101][101]) ^ element_sa.cpp: In function 'int nr_sa(int, int, int (*)[101])': element_sa.cpp:50:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
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ă.