#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 | #50247073 | Utilizator | |
Fișier | maxcif.cpp | Dimensiune | 496 B |
Data încărcării | 02 Aprilie 2024, 09:33 | Scor / rezultat | Eroare de compilare |
maxcif.cpp:4:23: warning: missing terminating " character [enabled by default] int main(){ifstream f("maxcif.in); ^ maxcif.cpp:4:1: error: missing terminating " character int main(){ifstream f("maxcif.in); ^ maxcif.cpp:3:16: error: array bound is not an integer constant before ']' token int n,i,max,v[i]; ^ maxcif.cpp: In function 'int main()': maxcif.cpp:5:33: error: expected ',' or '...' before '(' token ofstream g("maxcif.out"); ^ maxcif.cpp:5:47: error: expected ')' before ';' token ofstream g("maxcif.out"); ^ maxcif.cpp:6:32: error: invalid operands of types 'std::ifstream(std::ofstream) {aka std::basic_ifstream<char>(std::basic_ofstream<char>)}' and 'int' to binary 'operator>>' while(f>>n) ^ maxcif.cpp:7:25: error: 'v' was not declared in this scope { v[n]++; ^ maxcif.cpp:8:32: error: reference to 'max' is ambiguous if(v[n]>max) max=v[n]; ^ maxcif.cpp:3:9: note: candidates are: int max int n,i,max,v[i]; ^ 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:8:37: error: reference to 'max' is ambiguous if(v[n]>max) max=v[n]; ^ maxcif.cpp:3:9: note: candidates are: int max int n,i,max,v[i]; ^ 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:11:26: error: 'v' was not declared in this scope if(v[i]==max) ^ maxcif.cpp:11:32: error: reference to 'max' is ambiguous if(v[i]==max) ^ maxcif.cpp:3:9: note: candidates are: int max int n,i,max,v[i]; ^ 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:12:26: error: invalid operands of types 'std::ifstream(std::ofstream) {aka std::basic_ifstream<char>(std::basic_ofstream<char>)}' and 'int' to binary 'operator<<' f<<i<<" "; ^ maxcif.cpp:13:25: error: request for member 'close' in 'f', which is of non-class type 'std::ifstream(std::ofstream) {aka std::basic_ifstream<char>(std::basic_ofstream<char>)}' f.close(); ^ maxcif.cpp:14:23: error: 'g' was not declared in this scope g.close(); ^
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ă.