#2422
ProdusMaxim
Se citesc mai multe numere naturale nenule. Fiecare astfel de număr X
se va afișa, urmat de un triplet de numere a b c
cu proprietatea că a+b+c=X
, iar produsul lor este maxim.
Problema | ProdusMaxim | Operații I/O |
produsmaxim.in /produsmaxim.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 0.1 MB
/
Stivă 0 MB
|
Id soluție | #54830647 | Utilizator | |
Fișier | produsmaxim.cpp | Dimensiune | 643 B |
Data încărcării | 09 Decembrie 2024, 20:35 | Scor / rezultat | Eroare de compilare |
produsmaxim.cpp: In function 'int main()': produsmaxim.cpp:16:19: error: no match for 'operator/' (operand types are 'std::vector<int>' and 'int') int a = n / 3, b = a, c = a; ^ produsmaxim.cpp:16:19: note: candidates are: In file included from /usr/include/c++/4.8/ccomplex:38:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from produsmaxim.cpp:1: /usr/include/c++/4.8/complex:414:5: note: template<class _Tp> std::complex<_Tp> std::operator/(const std::complex<_Tp>&, const std::complex<_Tp>&) operator/(const complex<_Tp>& __x, const complex<_Tp>& __y) ^ /usr/include/c++/4.8/complex:414:5: note: template argument deduction/substitution failed: produsmaxim.cpp:16:21: note: 'std::vector<int>' is not derived from 'const std::complex<_Tp>' int a = n / 3, b = a, c = a; ^ In file included from /usr/include/c++/4.8/ccomplex:38:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from produsmaxim.cpp:1: /usr/include/c++/4.8/complex:423:5: note: template<class _Tp> std::complex<_Tp> std::operator/(const std::complex<_Tp>&, const _Tp&) operator/(const complex<_Tp>& __x, const _Tp& __y) ^ /usr/include/c++/4.8/complex:423:5: note: template argument deduction/substitution failed: produsmaxim.cpp:16:21: note: 'std::vector<int>' is not derived from 'const std::complex<_Tp>' int a = n / 3, b = a, c = a; ^ In file included from /usr/include/c++/4.8/ccomplex:38:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from produsmaxim.cpp:1: /usr/include/c++/4.8/complex:432:5: note: template<class _Tp> std::complex<_Tp> std::operator/(const _Tp&, const std::complex<_Tp>&) operator/(const _Tp& __x, const complex<_Tp>& __y) ^ /usr/include/c++/4.8/complex:432:5: note: template argument deduction/substitution failed: produsmaxim.cpp:16:21: note: mismatched types 'const std::complex<_Tp>' and 'int' int a = n / 3, b = a, c = a; ^ In file included from /usr/include/c++/4.8/valarray:587:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94, from produsmaxim.cpp:1: /usr/include/c++/4.8/bits/valarray_after.h:405:5: note: template<class _Dom1, class _Dom2> std::_Expr<std::_BinClos<std::__divides, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__divides, typename _Dom1::value_type>::result_type> std::operator/(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::_Expr<_Dom2, typename _Dom2::value_type>&) _DEFINE_EXPR_BINARY_OPERATOR(/, __divides) ^ /usr/include/c++/4.8/bits/valarray_after.h:405:5: note: template argument deduction/substitution failed: produsmaxim.cpp:16:21: note: 'std::vector<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' int a = n / 3, b = a, c = a; ^ In file included from /usr/include/c++/4.8/valarray:587:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94, from produsmaxim.cpp:1: /usr/include/c++/4.8/bits/valarray_after.h:405:5: note: template<class _Dom> std::_Expr<std::_BinClos<std::__divides, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__divides, typename _Dom1::value_type>::result_type> std::operator/(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&) _DEFINE_EXPR_BINARY_OPERATOR(/, __divides) ^ /usr/include/c++/4.8/bits/valarray_after.h:405:5: note: template argument deduction/substitution failed: produsmaxim.cpp:16:21: note: 'std::vector<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' int a = n / 3, b = a, c = a; ^ In file included from /usr/include/c++/4.8/valarray:587:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94, from produsmaxim.cpp:1: /usr/include/c++/4.8/bits/valarray_after.h:405:5: note: template<class _Dom> std::_Expr<std::_BinClos<std::__divides, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__divides, typename _Dom1::value_type>::result_type> std::operator/(const typename _Dom::value_type&, const std::_Expr<_Dom1, typename _Dom1::value_type>&) _DEFINE_EXPR_BINARY_OPERATOR(/, __divides) ^ /usr/include/c++/4.8/bits/valarray_after.h:405:5: note: template argument deduction/substitution failed: produsmaxim.cpp:16:21: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int' int a = n / 3, b = a, c = a; ^ In file included from /usr/include/c++/4.8/valarray:587:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94, from produsmaxim.cpp:1: /usr/include/c++/4.8/bits/valarray_after.h:405:5: note: template<class _Dom> std::_Expr<std::_BinClos<std::__divides, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__divides, typename _Dom1::value_type>::result_type> std::operator/(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::valarray<typename _Dom::value_type>&) _DEFINE_EXPR_BINARY_OPERATOR(/, __divides) ^ /usr/include/c++/4.8/bits/valarray_after.h:405:5: note: template argument deduction/substitution failed: produsmaxim.cpp:16:21: note: 'std::vector<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' int a = n / 3, b = a, c = a; ^ In file included from /usr/include/c++/4.8/valarray:587:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94, from produsmaxim.cpp:1: /usr/include/c++/4.8/bits/valarray_after.h:405:5: note: template<class _Dom> std::_Expr<std::_BinClos<std::__divides, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__divides, typename _Dom1::value_type>::result_type> std::operator/(const std::valarray<typename _Dom::value_type>&, const std::_Expr<_Dom1, typename _Dom1::value_type>&) _DEFINE_EXPR_BINARY_OPERATOR(/, __divides) ^ /usr/include/c++/4.8/bits/valarray_after.h:405:5: note: template argument deduction/substitution failed: produsmaxim.cpp:16:21: note: 'std::vector<int>' is not derived from 'const std::valarray<typename _Dom::value_type>' int a = n / 3, b = a, c = a; ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94:0, from produsmaxim.cpp:1: /usr/include/c++/4.8/valarray:1170:1: note: template<class _Tp> std::_Expr<std::_BinClos<std::__divides, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__divides, _Tp>::result_type> std::operator/(const std::valarray<_Tp>&, const std::valarray<_Tp>&) _DEFINE_BINARY_OPERATOR(/, __divides) ^ /usr/include/c++/4.8/valarray:1170:1: note: template argument deduction/substitution failed: produsmaxim.cpp:16:21: note: 'std::vector<int>' is not derived from 'const std::valarray<_Tp>' int a = n / 3, b = a, c = a; ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94:0, from produsmaxim.cpp:1: /usr/include/c++/4.8/valarray:1170:1: note: template<class _Tp> std::_Expr<std::_BinClos<std::__divides, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__divides, _Tp>::result_type> std::operator/(const std::valarray<_Tp>&, const _Tp&) _DEFINE_BINARY_OPERATOR(/, __divides) ^ /usr/include/c++/4.8/valarray:1170:1: note: template argument deduction/substitution failed: produsmaxim.cpp:16:21: note: 'std::vector<int>' is not derived from 'const std::valarray<_Tp>' int a = n / 3, b = a, c = a; ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94:0, from produsmaxim.cpp:1: /usr/include/c++/4.8/valarray:1170:1: note: template<class _Tp> std::_Expr<std::_BinClos<std::__divides, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__divides, _Tp>::result_type> std::operator/(const _Tp&, const std::valarray<_Tp>&) _DEFINE_BINARY_OPERATOR(/, __divides) ^ /usr/include/c++/4.8/valarray:1170:1: note: template argument deduction/substitution failed: produsmaxim.cpp:16:21: note: mismatched types 'const std::valarray<_Tp>' and 'int' int a = n / 3, b = a, c = a; ^ produsmaxim.cpp:17:19: error: no match for 'operator%' (operand types are 'std::vector<int>' and 'int') int r = n % 3; ^ produsmaxim.cpp:17:19: note: candidates are: In file included from /usr/include/c++/4.8/valarray:587:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94, from produsmaxim.cpp:1: /usr/include/c++/4.8/bits/valarray_after.h:406:5: note: template<class _Dom1, class _Dom2> std::_Expr<std::_BinClos<std::__modulus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::_Expr<_Dom2, typename _Dom2::value_type>&) _DEFINE_EXPR_BINARY_OPERATOR(%, __modulus) ^ /usr/include/c++/4.8/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: produsmaxim.cpp:17:21: note: 'std::vector<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' int r = n % 3; ^ In file included from /usr/include/c++/4.8/valarray:587:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94, from produsmaxim.cpp:1: /usr/include/c++/4.8/bits/valarray_after.h:406:5: note: template<class _Dom> std::_Expr<std::_BinClos<std::__modulus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&) _DEFINE_EXPR_BINARY_OPERATOR(%, __modulus) ^ /usr/include/c++/4.8/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: produsmaxim.cpp:17:21: note: 'std::vector<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' int r = n % 3; ^ In file included from /usr/include/c++/4.8/valarray:587:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94, from produsmaxim.cpp:1: /usr/include/c++/4.8/bits/valarray_after.h:406:5: note: template<class _Dom> std::_Expr<std::_BinClos<std::__modulus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const typename _Dom::value_type&, const std::_Expr<_Dom1, typename _Dom1::value_type>&) _DEFINE_EXPR_BINARY_OPERATOR(%, __modulus) ^ /usr/include/c++/4.8/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: produsmaxim.cpp:17:21: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int' int r = n % 3; ^ In file included from /usr/include/c++/4.8/valarray:587:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94, from produsmaxim.cpp:1: /usr/include/c++/4.8/bits/valarray_after.h:406:5: note: template<class _Dom> std::_Expr<std::_BinClos<std::__modulus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::valarray<typename _Dom::value_type>&) _DEFINE_EXPR_BINARY_OPERATOR(%, __modulus) ^ /usr/include/c++/4.8/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: produsmaxim.cpp:17:21: note: 'std::vector<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' int r = n % 3; ^ In file included from /usr/include/c++/4.8/valarray:587:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94, from produsmaxim.cpp:1: /usr/include/c++/4.8/bits/valarray_after.h:406:5: note: template<class _Dom> std::_Expr<std::_BinClos<std::__modulus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const std::valarray<typename _Dom::value_type>&, const std::_Expr<_Dom1, typename _Dom1::value_type>&) _DEFINE_EXPR_BINARY_OPERATOR(%, __modulus) ^ /usr/include/c++/4.8/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: produsmaxim.cpp:17:21: note: 'std::vector<int>' is not derived from 'const std::valarray<typename _Dom::value_type>' int r = n % 3; ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94:0, from produsmaxim.cpp:1: /usr/include/c++/4.8/valarray:1171:1: note: template<class _Tp> std::_Expr<std::_BinClos<std::__modulus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__modulus, _Tp>::result_type> std::operator%(const std::valarray<_Tp>&, const std::valarray<_Tp>&) _DEFINE_BINARY_OPERATOR(%, __modulus) ^ /usr/include/c++/4.8/valarray:1171:1: note: template argument deduction/substitution failed: produsmaxim.cpp:17:21: note: 'std::vector<int>' is not derived from 'const std::valarray<_Tp>' int r = n % 3; ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94:0, from produsmaxim.cpp:1: /usr/include/c++/4.8/valarray:1171:1: note: template<class _Tp> std::_Expr<std::_BinClos<std::__modulus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__modulus, _Tp>::result_type> std::operator%(const std::valarray<_Tp>&, const _Tp&) _DEFINE_BINARY_OPERATOR(%, __modulus) ^ /usr/include/c++/4.8/valarray:1171:1: note: template argument deduction/substitution failed: produsmaxim.cpp:17:21: note: 'std::vector<int>' is not derived from 'const std::valarray<_Tp>' int r = n % 3; ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94:0, from produsmaxim.cpp:1: /usr/include/c++/4.8/valarray:1171:1: note: template<class _Tp> std::_Expr<std::_BinClos<std::__modulus, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__modulus, _Tp>::result_type> std::operator%(const _Tp&, const std::valarray<_Tp>&) _DEFINE_BINARY_OPERATOR(%, __modulus) ^ /usr/include/c++/4.8/valarray:1171:1: note: template argument deduction/substitution failed: produsmaxim.cpp:17:21: note: mismatched types 'const std::valarray<_Tp>' and 'int' int r = n % 3; ^ produsmaxim.cpp:20:13: error: 'c' was not declared in this scope c += 1; ^ produsmaxim.cpp:22:13: error: 'b' was not declared in this scope b += 1; ^ produsmaxim.cpp:23:13: error: 'c' was not declared in this scope c += 1; ^ produsmaxim.cpp:26:17: error: cannot bind 'std::basic_ostream<char>' lvalue to 'std::basic_ostream<char>&&' fout << n << " " << min({a, b, c}) << " " << (a + b + c - min({a, b, c}) - max({a, b, c})) << " " << max({a, b, c}) << endl; ^ In file included from /usr/include/c++/4.8/istream:39:0, 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 produsmaxim.cpp:1: /usr/include/c++/4.8/ostream:602:5: error: initializing argument 1 of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&&, const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = std::vector<int>]' operator<<(basic_ostream<_CharT, _Traits>&& __os, const _Tp& __x) ^ produsmaxim.cpp:26:37: error: 'b' was not declared in this scope fout << n << " " << min({a, b, c}) << " " << (a + b + c - min({a, b, c}) - max({a, b, c})) << " " << max({a, b, c}) << endl; ^ produsmaxim.cpp:26:40: error: 'c' was not declared in this scope fout << n << " " << min({a, b, c}) << " " << (a + b + c - min({a, b, c}) - max({a, b, c})) << " " << max({a, b, c}) << endl; ^ produsmaxim.cpp:26:42: error: no matching function for call to 'min(<brace-enclosed initializer list>)' fout << n << " " << min({a, b, c}) << " " << (a + b + c - min({a, b, c}) - max({a, b, c})) << " " << max({a, b, c}) << endl; ^ produsmaxim.cpp:26:42: 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 produsmaxim.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: produsmaxim.cpp:26:42: note: candidate expects 2 arguments, 1 provided fout << n << " " << min({a, b, c}) << " " << (a + b + c - min({a, b, c}) - max({a, b, c})) << " " << max({a, b, c}) << endl; ^ 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 produsmaxim.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: produsmaxim.cpp:26:42: note: candidate expects 3 arguments, 1 provided fout << n << " " << min({a, b, c}) << " " << (a + b + c - min({a, b, c}) - max({a, b, c})) << " " << max({a, b, c}) << endl; ^ 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 produsmaxim.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: /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: produsmaxim.cpp:26: confused by earlier errors, bailing out Preprocessed source stored into /tmp/cc5LRTg7.out file, please attach this to your bugreport. ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/_usr_lib_gcc_i686-linux-gnu_4.8_cc1plus.0.crash'
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema ProdusMaxim 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ă.