#282
PozMax
Se dă un şir cu n
elemente, numere reale, numerotate de la 1
la n
. Determinaţi numărul de ordine al primei şi al ultimei apariţii a valorii maxime din şir.
Problema | PozMax | Operații I/O |
pozmax.in /pozmax.out
|
---|---|---|---|
Limita timp | 0.2 secunde | Limita memorie |
Total: 32 MB
/
Stivă 8 MB
|
Id soluție | #54265088 | Utilizator | |
Fișier | pozmax.cpp | Dimensiune | 394 B |
Data încărcării | 24 Noiembrie 2024, 01:00 | Scor / rezultat | Eroare de compilare |
pozmax.cpp:3:13: error: variable 'std::ifstream fin' has initializer but incomplete type ifstream fin("pozmax.in"); ^ pozmax.cpp:4:14: error: variable 'std::ofstream fout' has initializer but incomplete type ofstream fout("pozmax.out"); ^ pozmax.cpp: In function 'int main()': pozmax.cpp:11:14: error: reference to 'max' is ambiguous if(t>max) ^ pozmax.cpp:5:5: note: candidates are: int max int max=0,u=0,p=0,n,t; ^ 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 pozmax.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:216:5: note: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&) max(const _Tp& __a, const _Tp& __b) ^ pozmax.cpp:13:13: error: reference to 'max' is ambiguous max=t; ^ pozmax.cpp:5:5: note: candidates are: int max int max=0,u=0,p=0,n,t; ^ 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 pozmax.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:216:5: note: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&) max(const _Tp& __a, const _Tp& __b) ^ pozmax.cpp:15:16: error: reference to 'max' is ambiguous if (t==max) ^ pozmax.cpp:5:5: note: candidates are: int max int max=0,u=0,p=0,n,t; ^ 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 pozmax.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:216:5: note: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&) max(const _Tp& __a, const _Tp& __b) ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema PozMax 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ă.