#264
MaxCif
Se dau mai multe numere naturale formate din exact o cifră. Determinaţi cifrele cu număr maxim de apariţii.
Problema | MaxCif | Operații I/O |
maxcif.in /maxcif.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #55025183 | Utilizator | |
Fișier | maxcif.cpp | Dimensiune | 415 B |
Data încărcării | 17 Decembrie 2024, 09:45 | Scor / rezultat | Eroare de compilare |
maxcif.cpp:6:9: error: conflicting declaration 'int f [10]' int f[10]={0}; ^ maxcif.cpp:4:10: error: 'f' has a previous declaration as 'std::ifstream f' ifstream f("maxcif.in"); ^ maxcif.cpp: In function 'int main()': maxcif.cpp:14:14: error: no match for 'operator[]' (operand types are 'std::ifstream {aka std::basic_ifstream<char>}' and 'int') f[n]++; ^ maxcif.cpp:15:17: error: no match for 'operator[]' (operand types are 'std::ifstream {aka std::basic_ifstream<char>}' and 'int') if(f[n]>max) ^ maxcif.cpp:15:21: error: reference to 'max' is ambiguous if(f[n]>max) ^ maxcif.cpp:7:8: note: candidates are: int max int n, max=0; ^ 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 maxcif.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) ^ maxcif.cpp:16:17: error: reference to 'max' is ambiguous max=f[n]; ^ maxcif.cpp:7:8: note: candidates are: int max int n, max=0; ^ 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 maxcif.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) ^ maxcif.cpp:16:22: error: no match for 'operator[]' (operand types are 'std::ifstream {aka std::basic_ifstream<char>}' and 'int') max=f[n]; ^ maxcif.cpp:20:14: error: no match for 'operator[]' (operand types are 'std::ifstream {aka std::basic_ifstream<char>}' and 'int') if (f[i]==max) ^ maxcif.cpp:20:19: error: reference to 'max' is ambiguous if (f[i]==max) ^ maxcif.cpp:7:8: note: candidates are: int max int n, max=0; ^ 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 maxcif.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 MaxCif 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ă.