#2714
FrecvImp
Se dă un șir format din n
numere naturale. Toate valorile putere a lui 2
din acest șir au frecvență pară, cu o singură excepție. Determinați această valoare – putere a lui 2
cu frecvență impară.
Problema | FrecvImp | Operații I/O |
frecvimp.in /frecvimp.out
|
---|---|---|---|
Limita timp | 0.3 secunde | Limita memorie |
Total: 0.1 MB
/
Stivă 0.1 MB
|
Id soluție | #15526389 | Utilizator | |
Fișier | frecvimp.cpp | Dimensiune | 715 B |
Data încărcării | 19 Aprilie 2019, 17:13 | Scor / rezultat | Eroare de compilare |
frecvimp.cpp:6:30: warning: overflow in implicit constant conversion [-Woverflow] unsigned long long n, mxP = -2e9, mnP = 2e9, x; ^ frecvimp.cpp: In function 'int main()': frecvimp.cpp:15:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i=1; i<=n; ++i){ ^ frecvimp.cpp:25:29: error: no matching function for call to 'max(long long unsigned int&, int&)' mxP = max(mxP, p); ^ frecvimp.cpp:25:29: 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 frecvimp.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: frecvimp.cpp:25:29: note: deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'int') mxP = max(mxP, p); ^ 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 frecvimp.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: frecvimp.cpp:25:29: note: deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'int') mxP = max(mxP, p); ^ frecvimp.cpp:26:29: error: no matching function for call to 'min(long long unsigned int&, int&)' mnP = min(mnP, p); ^ frecvimp.cpp:26:29: 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 frecvimp.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template argument deduction/substitution failed: frecvimp.cpp:26:29: note: deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'int') mnP = min(mnP, p); ^ 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 frecvimp.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare) min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template argument deduction/substitution failed: frecvimp.cpp:26:29: note: deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'int') mnP = min(mnP, p); ^ frecvimp.cpp:31:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i=mnP; i<=mxP; ++i) ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema FrecvImp 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ă.