#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 | #17671389 | Utilizator | |
Fișier | element_sa.cpp | Dimensiune | 989 B |
Data încărcării | 17 Octombrie 2019, 08:41 | Scor / rezultat | Eroare de compilare |
element_sa.cpp: In function 'int nr_sa(int (*)[100], int, int)': element_sa.cpp:13:12: error: overloaded function with no contextual type information min=32600; ^ element_sa.cpp:14:9: error: overloaded function with no contextual type information max=0; ^ element_sa.cpp:17:26: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator>' if(min>a[i][j]) ^ element_sa.cpp:18:20: error: overloaded function with no contextual type information min=a[i][j]; ^ element_sa.cpp:19:26: error: the value of 'i' is not usable in a constant expression if(max<a[i][j]) ^ element_sa.cpp:9:9: note: 'int i' is not const int i, j, c=0; ^ element_sa.cpp:19:16: error: parse error in template argument list if(max<a[i][j]) ^ element_sa.cpp:19:27: error: cannot resolve overloaded function 'max' based on conversion to type 'bool' if(max<a[i][j]) ^ element_sa.cpp:20:20: error: overloaded function with no contextual type information max=a[i][j]; ^ element_sa.cpp:22:17: error: cannot resolve overloaded function 'min' based on conversion to type 'int' vlmin[i]=min; ^ element_sa.cpp:23:17: error: cannot resolve overloaded function 'max' based on conversion to type 'int' vlmax[i]=max; ^ element_sa.cpp:27:12: error: overloaded function with no contextual type information min=32600; ^ element_sa.cpp:28:12: error: overloaded function with no contextual type information max=0; ^ element_sa.cpp:31:26: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator>' if(min>a[i][j]) ^ element_sa.cpp:32:20: error: overloaded function with no contextual type information min=a[i][j]; ^ element_sa.cpp:33:26: error: the value of 'i' is not usable in a constant expression if(max<a[i][j]) ^ element_sa.cpp:9:9: note: 'int i' is not const int i, j, c=0; ^ element_sa.cpp:33:16: error: parse error in template argument list if(max<a[i][j]) ^ element_sa.cpp:33:27: error: cannot resolve overloaded function 'max' based on conversion to type 'bool' if(max<a[i][j]) ^ element_sa.cpp:34:20: error: overloaded function with no contextual type information max=a[i][j]; ^ element_sa.cpp:36:17: error: cannot resolve overloaded function 'min' based on conversion to type 'int' vcmin[i]=min; ^ element_sa.cpp:37:17: error: cannot resolve overloaded function 'max' based on conversion to type 'int' vcmax[i]=max; ^ element_sa.cpp:42:31: error: invalid types 'int [(((sizetype)(((ssizetype)n) + -1)) + 1)][<unresolved overloaded function type>]' for array subscript if(a[i][j]==vlmin[min] && a[i][j]==vcmax[max]) ^ element_sa.cpp:42:54: error: invalid types 'int [(((sizetype)(((ssizetype)n) + -1)) + 1)][<unresolved overloaded function type>]' for array subscript if(a[i][j]==vlmin[min] && a[i][j]==vcmax[max]) ^ element_sa.cpp:44:34: error: invalid types 'int [(((sizetype)(((ssizetype)n) + -1)) + 1)][<unresolved overloaded function type>]' for array subscript if(a[i][j]==vlmax[max] && a[i][j]==vcmin[min]) ^ element_sa.cpp:44:57: error: invalid types 'int [(((sizetype)(((ssizetype)n) + -1)) + 1)][<unresolved overloaded function type>]' for array subscript if(a[i][j]==vlmax[max] && a[i][j]==vcmin[min]) ^
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ă.