#82
Se cere determinarea maximului şi minimului valorilor dintr-un sir
| Problema | MinMax | Operații I/O |
minmax.in/minmax.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64926658 | Utilizator | |
| Fișier | minmax.cpp | Dimensiune | 366 B |
| Data încărcării | 15 Iunie 2026, 07:54 | Scor/rezultat | Eroare de compilare |
minmax.cpp:3:1: error: ‘ofstream’ does not name a type 3 | ofstream fout("minmax.out"); | ^~~~~~~~ minmax.cpp:4:1: error: ‘ifstream’ does not name a type 4 | ifstream fin("minmax.in"); | ^~~~~~~~ minmax.cpp: In function ‘int main()’: minmax.cpp:9:5: error: ‘fin’ was not declared in this scope; did you mean ‘min’? 9 | fin>>n; | ^~~ | min minmax.cpp:12:17: error: reference to ‘min’ is ambiguous 12 | if(v[i]<min) min = v[i]; | ^~~ In file included from /usr/include/c++/13/string:51, from /usr/include/c++/13/bits/locale_classes.h:40, from /usr/include/c++/13/bits/ios_base.h:41, from /usr/include/c++/13/ios:44, from /usr/include/c++/13/ostream:40, from /usr/include/c++/13/iostream:41, from minmax.cpp:1: /usr/include/c++/13/bits/stl_algobase.h:281:5: note: candidates are: ‘template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)’ 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:233:5: note: ‘template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)’ 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ minmax.cpp:6:20: note: ‘int min’ 6 | int i, n, v[1001], min = 1000000, max = 0; | ^~~ minmax.cpp:12:22: error: reference to ‘min’ is ambiguous 12 | if(v[i]<min) min = v[i]; | ^~~ /usr/include/c++/13/bits/stl_algobase.h:281:5: note: candidates are: ‘template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)’ 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:233:5: note: ‘template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)’ 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ minmax.cpp:6:20: note: ‘int min’ 6 | int i, n, v[1001], min = 1000000, max = 0; | ^~~ minmax.cpp:13:17: error: reference to ‘max’ is ambiguous 13 | if(v[i]>max) max = v[i]; | ^~~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidates are: ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’ 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:257:5: note: ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’ 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ minmax.cpp:6:35: note: ‘int max’ 6 | int i, n, v[1001], min = 1000000, max = 0; | ^~~ minmax.cpp:13:22: error: reference to ‘max’ is ambiguous 13 | if(v[i]>max) max = v[i]; | ^~~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidates are: ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’ 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:257:5: note: ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’ 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ minmax.cpp:6:35: note: ‘int max’ 6 | int i, n, v[1001], min = 1000000, max = 0; | ^~~ minmax.cpp:15:5: error: ‘fout’ was not declared in this scope 15 | fout<<min<<" "<<max; | ^~~~ minmax.cpp:15:11: error: reference to ‘min’ is ambiguous 15 | fout<<min<<" "<<max; | ^~~ /usr/include/c++/13/bits/stl_algobase.h:281:5: note: candidates are: ‘template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)’ 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:233:5: note: ‘template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)’ 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ minmax.cpp:6:20: note: ‘int min’ 6 | int i, n, v[1001], min = 1000000, max = 0; | ^~~ minmax.cpp:15:21: error: reference to ‘max’ is ambiguous 15 | fout<<min<<" "<<max; | ^~~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidates are: ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’ 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:257:5: note: ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’ 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ minmax.cpp:6:35: note: ‘int max’ 6 | int i, n, v[1001], min = 1000000, max = 0; | ^~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema MinMax 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ă.