#486
MinMax0
Să se determine maximul şi minimul valorilor elementelor unui vector.
Problema | MinMax0 | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #54149069 | Utilizator | |
Fișier | minmax0.cpp | Dimensiune | 235 B |
Data încărcării | 20 Noiembrie 2024, 19:53 | Scor / rezultat | Eroare de compilare |
minmax0.cpp: In function 'int main()': minmax0.cpp:9:16: error: the value of 'i' is not usable in a constant expression if(max<i) ^ minmax0.cpp:3:8: note: 'int i' is not const int n, i=0, mx, min=10; ^ minmax0.cpp:9:12: error: parse error in template argument list if(max<i) ^ minmax0.cpp:9:17: error: cannot resolve overloaded function 'max' based on conversion to type 'bool' if(max<i) ^ minmax0.cpp:11:12: error: reference to 'min' is ambiguous if(min>i) ^ minmax0.cpp:3:17: note: candidates are: int min int n, i=0, mx, min=10; ^ 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 minmax0.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:193:5: note: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^ minmax0.cpp:12:13: error: reference to 'min' is ambiguous min=i; ^ minmax0.cpp:3:17: note: candidates are: int min int n, i=0, mx, min=10; ^ 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 minmax0.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:193:5: note: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^ minmax0.cpp:14:20: error: reference to 'min' is ambiguous cout<<mx<<" "<<min; ^ minmax0.cpp:3:17: note: candidates are: int min int n, i=0, mx, min=10; ^ 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 minmax0.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:193:5: note: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema MinMax0 face parte din prima categorie. 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ă.