#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 | #54009845 | Utilizator | |
Fișier | maxcif.cpp | Dimensiune | 660 B |
Data încărcării | 17 Noiembrie 2024, 19:29 | Scor / rezultat | Eroare de compilare |
maxcif.cpp: In function 'int main()': maxcif.cpp:8:15: error: conflicting declaration 'std::ofstream f' ofstream f("maxcif.out"); ^ maxcif.cpp:7:14: error: 'f' has a previous declaration as 'std::ifstream f' ifstream f("maxcif.in"); ^ maxcif.cpp:19:15: error: 'i' was not declared in this scope for(i=1;i<=10;i++) ^ maxcif.cpp:20:28: error: reference to 'max' is ambiguous if(frecv[i]>=max) ^ maxcif.cpp:4:21: note: candidates are: int max int frecv[10],x,cif,max=-1; ///daca declaram local , in main, vectorul frecv, il initializam cu 0: frecv[10]={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:21:17: error: reference to 'max' is ambiguous max=frecv[i]; ^ maxcif.cpp:4:21: note: candidates are: int max int frecv[10],x,cif,max=-1; ///daca declaram local , in main, vectorul frecv, il initializam cu 0: frecv[10]={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:22:11: error: 'fout' was not declared in this scope fout<<max; ^ maxcif.cpp:22:17: error: reference to 'max' is ambiguous fout<<max; ^ maxcif.cpp:4:21: note: candidates are: int max int frecv[10],x,cif,max=-1; ///daca declaram local , in main, vectorul frecv, il initializam cu 0: frecv[10]={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ă.