#3579
S_maxim
Fie un vector cu n elemente numere naturale. Determinați suma maximă care se poate obține prin adunarea valorilor care nu se află pe poziții consecutive în vector.
Problema | S_maxim | Operații I/O |
smax.in /smax.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 16 MB
|
Id soluție | #50221519 | Utilizator | |
Fișier | s_maxim.cpp | Dimensiune | 732 B |
Data încărcării | 01 Aprilie 2024, 11:59 | Scor / rezultat | Eroare de compilare |
s_maxim.cpp: In function 'int main()': s_maxim.cpp:31:34: error: no matching function for call to 'max(long long int&, int&)' lmax=max(lmax,v[j].lm); ^ s_maxim.cpp:31:34: 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/istream:38, from /usr/include/c++/4.8/fstream:38, from s_maxim.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: s_maxim.cpp:31:34: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') lmax=max(lmax,v[j].lm); ^ 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/istream:38, from /usr/include/c++/4.8/fstream:38, from s_maxim.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: s_maxim.cpp:31:34: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') lmax=max(lmax,v[j].lm); ^ s_maxim.cpp:43:26: error: no matching function for call to 'max(long long int&, int&)' lmax=max(lmax,v[i].lm); ^ s_maxim.cpp:43:26: 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/istream:38, from /usr/include/c++/4.8/fstream:38, from s_maxim.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: s_maxim.cpp:43:26: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') lmax=max(lmax,v[i].lm); ^ 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/istream:38, from /usr/include/c++/4.8/fstream:38, from s_maxim.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: s_maxim.cpp:43:26: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') lmax=max(lmax,v[i].lm); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema S_maxim 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ă.