#354
Se dau n numere întregi. Calculaţi cel mai mare dintre cele n numere date.
| Problema | n_maxim | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64826994 | Utilizator | |
| Fișier | n_maxim.cpp | Dimensiune | 211 B |
| Data încărcării | 04 Iunie 2026, 08:38 | Scor/rezultat | Eroare de compilare |
n_maxim.cpp: In function ‘int main()’: n_maxim.cpp:6:13: error: reference to ‘max’ is ambiguous 6 | cin>>n>>max; | ^~~ 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 n_maxim.cpp:1: /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) | ^~~ n_maxim.cpp:3:7: note: ‘int max’ 3 | int n,max,x; | ^~~ n_maxim.cpp:8:13: error: ‘i’ was not declared in this scope 8 | for(i=2; i<=n; i++) | ^ n_maxim.cpp:9:14: error: reference to ‘max’ is ambiguous 9 | if(x>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) | ^~~ n_maxim.cpp:3:7: note: ‘int max’ 3 | int n,max,x; | ^~~ n_maxim.cpp:10:9: error: reference to ‘max’ is ambiguous 10 | max=x; | ^~~ /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) | ^~~ n_maxim.cpp:3:7: note: ‘int max’ 3 | int n,max,x; | ^~~ n_maxim.cpp:7:5: warning: this ‘while’ clause does not guard... [-Wmisleading-indentation] 7 | while(n!=0) | ^~~~~ n_maxim.cpp:11:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘while’ 11 | cout<<max; | ^~~~ n_maxim.cpp:11:15: error: reference to ‘max’ is ambiguous 11 | cout<<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) | ^~~ n_maxim.cpp:3:7: note: ‘int max’ 3 | int n,max,x; | ^~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema n_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ă.