#3970
sum_prod
Scrie un program care pentru un număr natural nenul n
, găsește numărul de secvențe de numere naturale nenule a1, a2, a3,..., an
, astfel încât a1 * a2 * a3 *...* an = a1 + a2 + a3 +...+ an
și a1 ≥ a2 ≥ a3 ≥...≥ an
.
Turneul Internațional Shumen 2021
Problema | sum_prod | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 2.6 secunde | Limita memorie |
Total: 256 MB
/
Stivă 128 MB
|
Id soluție | #54447954 | Utilizator | |
Fișier | sum_prod.cpp | Dimensiune | 1.96 KB |
Data încărcării | 28 Noiembrie 2024, 17:36 | Scor / rezultat | Eroare de compilare |
sum_prod.cpp: In member function 'std::size_t std::hash<std::tuple<_Elements ...> >::operator()(const std::tuple<_Elements ...>&) const': sum_prod.cpp:14:44: error: expansion pattern 'const auto&' contains no argument packs return apply([](const auto&... args) { ^ sum_prod.cpp: In lambda function: sum_prod.cpp:16:18: error: expected primary-expression before '...' token (..., (seed ^= std::hash<std::decay_t<decltype(args)>>{}(args) + 0x9e3779b9 + (seed << 6) + (seed >> 2))); ^ sum_prod.cpp:16:18: error: expected ')' before '...' token sum_prod.cpp:16:74: error: 'args' was not declared in this scope (..., (seed ^= std::hash<std::decay_t<decltype(args)>>{}(args) + 0x9e3779b9 + (seed << 6) + (seed >> 2))); ^ sum_prod.cpp:16:120: error: expected ';' before ')' token (..., (seed ^= std::hash<std::decay_t<decltype(args)>>{}(args) + 0x9e3779b9 + (seed << 6) + (seed >> 2))); ^ sum_prod.cpp: In function 'int main()': sum_prod.cpp:68:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (unsigned long long i = 2; i <= n; ++i) ^ sum_prod.cpp: In instantiation of 'std::size_t std::hash<std::tuple<_Elements ...> >::operator()(const std::tuple<_Elements ...>&) const [with T = {long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int}; std::size_t = unsigned int]': /usr/include/c++/4.8/bits/hashtable_policy.h:1103:22: required from 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, std::__detail::_Default_ranged_hash, true>::__hash_code std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, std::__detail::_Default_ranged_hash, true>::_M_hash_code(const _Key&) const [with _Key = std::tuple<long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int>; _Value = std::pair<const std::tuple<long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int>, long long unsigned int>; _ExtractKey = std::__detail::_Select1st; _H1 = std::hash<std::tuple<long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int> >; _H2 = std::__detail::_Mod_range_hashing; std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, std::__detail::_Default_ranged_hash, true>::__hash_code = unsigned int]' /usr/include/c++/4.8/bits/hashtable.h:1023:50: required from 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::iterator std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::find(const key_type&) [with _Key = std::tuple<long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int>; _Value = std::pair<const std::tuple<long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int>, long long unsigned int>; _Alloc = std::allocator<std::pair<const std::tuple<long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int>, long long unsigned int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::tuple<long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int> >; _H1 = std::hash<std::tuple<long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int> >; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>; std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::iterator = std::__detail::_Node_iterator<std::pair<const std::tuple<long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int>, long long unsigned int>, false, true>; std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::key_type = std::tuple<long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int>]' /usr/include/c++/4.8/bits/unordered_map.h:543:29: required from 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::iterator std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::find(const key_type&) [with _Key = std::tuple<long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int>; _Tp = long long unsigned int; _Hash = std::hash<std::tuple<long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int> >; _Pred = std::equal_to<std::tuple<long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int> >; _Alloc = std::allocator<std::pair<const std::tuple<long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int>, long long unsigned int> >; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::iterator = std::__detail::_Node_iterator<std::pair<const std::tuple<long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int>, long long unsigned int>, false, true>; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_type = std::tuple<long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int>]' sum_prod.cpp:48:22: required from here sum_prod.cpp:18:17: error: 'apply' was not declared in this scope }, t); ^ sum_prod.cpp: In member function 'std::size_t std::hash<std::tuple<_Elements ...> >::operator()(const std::tuple<_Elements ...>&) const [with T = {long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int}; std::size_t = unsigned int]': sum_prod.cpp:19:9: warning: control reaches end of non-void function [-Wreturn-type] } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema sum_prod 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ă.