#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 | #54168279 | Utilizator | |
Fișier | element_sa.cpp | Dimensiune | 264 B |
Data încărcării | 21 Noiembrie 2024, 10:28 | Scor / rezultat | Eroare de compilare |
element_sa.cpp: In function 'int nr_sa(int (*)[100], int, int)': element_sa.cpp:11:32: error: no matching function for call to 'max(<brace-enclosed initializer list>)' if((a[i][j]==max({a[i]}) && a[i][j]==min({a[j]})) || (a[i][j]==min({a[i]}) && a[i][j]==max({a[j]}))) ^ element_sa.cpp:11:32: note: candidates are: In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from element_sa.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&) max(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template argument deduction/substitution failed: element_sa.cpp:11:32: note: candidate expects 2 arguments, 1 provided if((a[i][j]==max({a[i]}) && a[i][j]==min({a[j]})) || (a[i][j]==min({a[i]}) && a[i][j]==max({a[j]}))) ^ In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from element_sa.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare) max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template argument deduction/substitution failed: element_sa.cpp:11:32: note: candidate expects 3 arguments, 1 provided if((a[i][j]==max({a[i]}) && a[i][j]==min({a[j]})) || (a[i][j]==min({a[i]}) && a[i][j]==max({a[j]}))) ^ element_sa.cpp:11:56: error: no matching function for call to 'min(<brace-enclosed initializer list>)' if((a[i][j]==max({a[i]}) && a[i][j]==min({a[j]})) || (a[i][j]==min({a[i]}) && a[i][j]==max({a[j]}))) ^ element_sa.cpp:11:56: note: candidates are: In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from element_sa.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template argument deduction/substitution failed: element_sa.cpp:11:56: note: candidate expects 2 arguments, 1 provided if((a[i][j]==max({a[i]}) && a[i][j]==min({a[j]})) || (a[i][j]==min({a[i]}) && a[i][j]==max({a[j]}))) ^ In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from element_sa.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare) min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template argument deduction/substitution failed: element_sa.cpp:11:56: note: candidate expects 3 arguments, 1 provided if((a[i][j]==max({a[i]}) && a[i][j]==min({a[j]})) || (a[i][j]==min({a[i]}) && a[i][j]==max({a[j]}))) ^ element_sa.cpp:11:82: error: no matching function for call to 'min(<brace-enclosed initializer list>)' if((a[i][j]==max({a[i]}) && a[i][j]==min({a[j]})) || (a[i][j]==min({a[i]}) && a[i][j]==max({a[j]}))) ^ element_sa.cpp:11:82: note: candidates are: In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from element_sa.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template argument deduction/substitution failed: element_sa.cpp:11:82: note: candidate expects 2 arguments, 1 provided if((a[i][j]==max({a[i]}) && a[i][j]==min({a[j]})) || (a[i][j]==min({a[i]}) && a[i][j]==max({a[j]}))) ^ In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from element_sa.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare) min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template argument deduction/substitution failed: element_sa.cpp:11:82: note: candidate expects 3 arguments, 1 provided if((a[i][j]==max({a[i]}) && a[i][j]==min({a[j]})) || (a[i][j]==min({a[i]}) && a[i][j]==max({a[j]}))) ^ element_sa.cpp:11:106: error: no matching function for call to 'max(<brace-enclosed initializer list>)' if((a[i][j]==max({a[i]}) && a[i][j]==min({a[j]})) || (a[i][j]==min({a[i]}) && a[i][j]==max({a[j]}))) ^ element_sa.cpp:11:106: note: candidates are: In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from element_sa.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&) max(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template argument deduction/substitution failed: element_sa.cpp:11:106: note: candidate expects 2 arguments, 1 provided if((a[i][j]==max({a[i]}) && a[i][j]==min({a[j]})) || (a[i][j]==min({a[i]}) && a[i][j]==max({a[j]}))) ^ In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from element_sa.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare) max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template argument deduction/substitution failed: element_sa.cpp:11:106: note: candidate expects 3 arguments, 1 provided if((a[i][j]==max({a[i]}) && a[i][j]==min({a[j]})) || (a[i][j]==min({a[i]}) && a[i][j]==max({a[j]}))) ^
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ă.