#4172
expresia
Dorel are o expresie aritmetică reprezentată ca un șir de caractere de lungime N
, ce conține ca operanzi cifre nenule, iar ca operatori aritmetici adunarea și înmulțirea, operatori reprezentați prin +
și *
. Asupra expresiei aritmetice se pot efectua cel mult K
operații de interschimbare între doi operatori. De exemplu, pentru expresia 2*3+5+7+1
, a cărei valoare este 19
, dacă efectuăm o operație de interschimbare între primul și cel de-al treilea operator obținem expresia 2+3+5*7+1
, a cărei valoare este 41
. Să se afle valoarea maximă a expresiei după efectuarea a cel mult K
operații de interschimbare între doi operatori.
Lot juniori, Cluj-Napoca 2022
Problema | expresia | Operații I/O |
expresia.in /expresia.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #44884503 | Utilizator | |
Fișier | expresia.cpp | Dimensiune | 3.50 KB |
Data încărcării | 25 Septembrie 2023, 22:16 | Scor / rezultat | Eroare de compilare |
expresia.cpp: In function 'void solve(long long int)': expresia.cpp:16:16: error: no matching function for call to 'min(long long int&, int)' k = min(k, 18); // OFWEFWEUFJWJFGWOJGSLKJG PU493867 34JSD;LGAKR '858502SGLKDJ[24]' AO76W4EINI W7NJHFST IW34P59 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ^ expresia.cpp:16:16: 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/istream:38, from /usr/include/c++/4.8/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from expresia.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: expresia.cpp:16:16: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') k = min(k, 18); // OFWEFWEUFJWJFGWOJGSLKJG PU493867 34JSD;LGAKR '858502SGLKDJ[24]' AO76W4EINI W7NJHFST IW34P59 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ^ 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/istream:38, from /usr/include/c++/4.8/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from expresia.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: expresia.cpp:16:16: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') k = min(k, 18); // OFWEFWEUFJWJFGWOJGSLKJG PU493867 34JSD;LGAKR '858502SGLKDJ[24]' AO76W4EINI W7NJHFST IW34P59 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from expresia.cpp:1: /usr/include/c++/4.8/bits/stl_algo.h:4221:5: note: template<class _Tp> _Tp std::min(std::initializer_list<_Tp>) min(initializer_list<_Tp> __l) ^ /usr/include/c++/4.8/bits/stl_algo.h:4221:5: note: template argument deduction/substitution failed: expresia.cpp:16:16: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' k = min(k, 18); // OFWEFWEUFJWJFGWOJGSLKJG PU493867 34JSD;LGAKR '858502SGLKDJ[24]' AO76W4EINI W7NJHFST IW34P59 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from expresia.cpp:1: /usr/include/c++/4.8/bits/stl_algo.h:4226:5: note: template<class _Tp, class _Compare> _Tp std::min(std::initializer_list<_Tp>, _Compare) min(initializer_list<_Tp> __l, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algo.h:4226:5: note: template argument deduction/substitution failed: expresia.cpp:16:16: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' k = min(k, 18); // OFWEFWEUFJWJFGWOJGSLKJG PU493867 34JSD;LGAKR '858502SGLKDJ[24]' AO76W4EINI W7NJHFST IW34P59 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ^ expresia.cpp: In function 'int main()': expresia.cpp:91:37: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] freopen("expresia.in", "r", stdin); ^ expresia.cpp:92:39: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] freopen("expresia.out", "w", stdout); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema expresia 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ă.