#4516
Dat numărul natural n
, să se determine cel mai mare număr de trei cifre conținut în n
.
Problema | max3cif | Operații I/O |
![]() |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #57809115 | Utilizator | |
Fișier | max3cif.cpp | Dimensiune | 276 B |
Data încărcării | 18 Aprilie 2025, 20:04 | Scor / rezultat | Eroare de compilare |
max3cif.cpp: In function 'int main()': max3cif.cpp:9:74: error: no matching function for call to 'max(int&, long long int)' maxNr = max(maxNr, n / 100 % 10 * 100 + n / 10 % 10 * 10 + n % 10); ^ max3cif.cpp:9:74: 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/ostream:38, from /usr/include/c++/4.8/iostream:39, from max3cif.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: max3cif.cpp:9:74: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') maxNr = max(maxNr, n / 100 % 10 * 100 + n / 10 % 10 * 10 + n % 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 max3cif.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: max3cif.cpp:9:74: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') maxNr = max(maxNr, n / 100 % 10 * 100 + n / 10 % 10 * 10 + n % 10); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema max3cif 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ă.