#2925
FactorialnHard
Se dă numărul natural n
. Să se afișeze \( {(n!)}^{n} \).
Problema | FactorialnHard | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.53 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #50411672 | Utilizator | |
Fișier | factorialnhard.cpp | Dimensiune | 350 B |
Data încărcării | 08 Aprilie 2024, 18:02 | Scor / rezultat | Eroare de compilare |
factorialnhard.cpp: In function 'int main()': factorialnhard.cpp:9:6: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'int') a[0]=1; ^ factorialnhard.cpp:9:6: note: candidates are: In file included from /usr/include/c++/4.8/vector:69:0, from factorialnhard.cpp:1: /usr/include/c++/4.8/bits/vector.tcc:160:5: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>] vector<_Tp, _Alloc>:: ^ /usr/include/c++/4.8/bits/vector.tcc:160:5: note: no known conversion for argument 1 from 'int' to 'const std::vector<int>&' In file included from /usr/include/c++/4.8/vector:64:0, from factorialnhard.cpp:1: /usr/include/c++/4.8/bits/stl_vector.h:439:7: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>] operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) ^ /usr/include/c++/4.8/bits/stl_vector.h:439:7: note: no known conversion for argument 1 from 'int' to 'std::vector<int>&&' /usr/include/c++/4.8/bits/stl_vector.h:461:7: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>] operator=(initializer_list<value_type> __l) ^ /usr/include/c++/4.8/bits/stl_vector.h:461:7: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<int>' factorialnhard.cpp:10:6: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'int') a[1]=1; ^ factorialnhard.cpp:10:6: note: candidates are: In file included from /usr/include/c++/4.8/vector:69:0, from factorialnhard.cpp:1: /usr/include/c++/4.8/bits/vector.tcc:160:5: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>] vector<_Tp, _Alloc>:: ^ /usr/include/c++/4.8/bits/vector.tcc:160:5: note: no known conversion for argument 1 from 'int' to 'const std::vector<int>&' In file included from /usr/include/c++/4.8/vector:64:0, from factorialnhard.cpp:1: /usr/include/c++/4.8/bits/stl_vector.h:439:7: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>] operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) ^ /usr/include/c++/4.8/bits/stl_vector.h:439:7: note: no known conversion for argument 1 from 'int' to 'std::vector<int>&&' /usr/include/c++/4.8/bits/stl_vector.h:461:7: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>] operator=(initializer_list<value_type> __l) ^ /usr/include/c++/4.8/bits/stl_vector.h:461:7: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<int>' factorialnhard.cpp:13:12: error: no match for 'operator<=' (operand types are 'int' and 'std::vector<int>') {for(k=1;k<=a[0];k++,r/=10) ^ factorialnhard.cpp:13:12: note: candidates are: In file included from /usr/include/c++/4.8/bits/stl_algobase.h:64:0, from /usr/include/c++/4.8/vector:60, from factorialnhard.cpp:1: /usr/include/c++/4.8/bits/stl_pair.h:239:5: note: template<class _T1, class _T2> constexpr bool std::operator<=(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&) operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) ^ /usr/include/c++/4.8/bits/stl_pair.h:239:5: note: template argument deduction/substitution failed: factorialnhard.cpp:13:17: note: mismatched types 'const std::pair<_T1, _T2>' and 'int' {for(k=1;k<=a[0];k++,r/=10) ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0, from /usr/include/c++/4.8/vector:60, from factorialnhard.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:315:5: note: template<class _Iterator> bool std::operator<=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&) operator<=(const reverse_iterator<_Iterator>& __x, ^ /usr/include/c++/4.8/bits/stl_iterator.h:315:5: note: template argument deduction/substitution failed: factorialnhard.cpp:13:17: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' {for(k=1;k<=a[0];k++,r/=10) ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0, from /usr/include/c++/4.8/vector:60, from factorialnhard.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:365:5: note: template<class _IteratorL, class _IteratorR> bool std::operator<=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&) operator<=(const reverse_iterator<_IteratorL>& __x, ^ /usr/include/c++/4.8/bits/stl_iterator.h:365:5: note: template argument deduction/substitution failed: factorialnhard.cpp:13:17: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' {for(k=1;k<=a[0];k++,r/=10) ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0, from /usr/include/c++/4.8/vector:60, from factorialnhard.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:1067:5: note: template<class _IteratorL, class _IteratorR> bool std::operator<=(const std::move_iterator<_Iterator>&, const std::move_iterator<_IteratorR>&) operator<=(const move_iterator<_IteratorL>& __x, ^ /usr/include/c++/4.8/bits/stl_iterator.h:1067:5: note: template argument deduction/substitution failed: factorialnhard.cpp:13:17: note: mismatched types 'const std::move_iterator<_Iterator>' and 'int' {for(k=1;k<=a[0];k++,r/=10) ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0, from /usr/include/c++/4.8/vector:60, from factorialnhard.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:1073:5: note: template<class _Iterator> bool std::operator<=(const std::move_iterator<_Iterator>&, const std::move_iterator<_Iterator>&) operator<=(const move_iterator<_Iterator>& __x, ^ /usr/include/c++/4.8/bits/stl_iterator.h:1073:5: note: template argument deduction/substitution failed: factorialnhard.cpp:13:17: note: mismatched types 'const std::move_iterator<_Iterator>' and 'int' {for(k=1;k<=a[0];k++,r/=10) ^ In file included from /usr/include/c++/4.8/vector:64:0, from factorialnhard.cpp:1: /usr/include/c++/4.8/bits/stl_vector.h:1440:5: note: template<class _Tp, class _Alloc> bool std::operator<=(const std::vector<_Tp, _Alloc>&, const std::vector<_Tp, _Alloc>&) operator<=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) ^ /usr/include/c++/4.8/bits/stl_vector.h:1440:5: note: template argument deduction/substitution failed: factorialnhard.cpp:13:17: note: mismatched types 'const std::vector<_Tp, _Alloc>' and 'int' {for(k=1;k<=a[0];k++,r/=10) ^ In file included from /usr/include/c++/4.8/string:52:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from factorialnhard.cpp:2: /usr/include/c++/4.8/bits/basic_string.h:2643:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const std::basic_string<_CharT, _Traits, _Alloc>&, const std::basic_string<_CharT, _Traits, _Alloc>&) operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, ^ /usr/include/c++/4.8/bits/basic_string.h:2643:5: note: template argument deduction/substitution failed: factorialnhard.cpp:13:17: note: mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'int' {for(k=1;k<=a[0];k++,r/=10) ^ In file included from /usr/include/c++/4.8/string:52:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from factorialnhard.cpp:2: /usr/include/c++/4.8/bits/basic_string.h:2655:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const std::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*) operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, ^ /usr/include/c++/4.8/bits/basic_string.h:2655:5: note: template argument deduction/substitution failed: factorialnhard.cpp:13:17: note: mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'int' {for(k=1;k<=a[0];k++,r/=10) ^ In file included from /usr/include/c++/4.8/string:52:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from factorialnhard.cpp:2: /usr/include/c++/4.8/bits/basic_string.h:2667:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const _CharT*, const std::basic_string<_CharT, _Traits, _Alloc>&) operator<=(const _CharT* __lhs, ^ /usr/include/c++/4.8/bits/basic_string.h:2667:5: note: template argument deduction/substitution failed: factorialnhard.cpp:13:17: note: mismatched types 'const _CharT*' and 'int' {for(k=1;k<=a[0];k++,r/=10) ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0, from /usr/include/c++/4.8/vector:60, from factorialnhard.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:860:5: note: template<class _Iterator, class _Container> bool __gnu_cxx::operator<=(const __gnu_cxx::__normal_iterator<_Iterator, _Container>&, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&) operator<=(const __normal_iterator<_Iterator, _Container>& __lhs, ^ /usr/include/c++/4.8/bits/stl_iterator.h:860:5: note: template argument deduction/substitution failed: factorialnhard.cpp:13:17: note: mismatched types 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' and 'int' {for(k=1;k<=a[0];k++,r/=10) ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0, from /usr/include/c++/4.8/vector:60, from factorialnhard.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:854:5: note: template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<=(const __gnu_cxx::__normal_iterator<_IteratorL, _Container>&, const __gnu_cxx::__normal_iterator<_IteratorR, _Container>&) operator<=(const __normal_iterator<_IteratorL, _Container>& __lhs, ^ /usr/include/c++/4.8/bits/stl_iterator.h:854:5: note: template argument deduction/substitution failed: factorialnhard.cpp:13:17: note: mismatched types 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>' and 'int' {for(k=1;k<=a[0];k++,r/=10) ^ factorialnhard.cpp:14:10: error: no match for 'operator*' (operand types are 'std::vector<int>' and 'int') {r+=a[k]*i; ^ factorialnhard.cpp:15:7: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'int') a[k]=r%10; ^ factorialnhard.cpp:15:7: note: candidates are: In file included from /usr/include/c++/4.8/vector:69:0, from factorialnhard.cpp:1: /usr/include/c++/4.8/bits/vector.tcc:160:5: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>] vector<_Tp, _Alloc>:: ^ /usr/include/c++/4.8/bits/vector.tcc:160:5: note: no known conversion for argument 1 from 'int' to 'const std::vector<int>&' In file included from /usr/include/c++/4.8/vector:64:0, from factorialnhard.cpp:1: /usr/include/c++/4.8/bits/stl_vector.h:439:7: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>] operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) ^ /usr/include/c++/4.8/bits/stl_vector.h:439:7: note: no known conversion for argument 1 from 'int' to 'std::vector<int>&&' /usr/include/c++/4.8/bits/stl_vector.h:461:7: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>] operator=(initializer_list<value_type> __l) ^ /usr/include/c++/4.8/bits/stl_vector.h:461:7: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<int>' factorialnhard.cpp:18:7: error: no match for 'operator++' (operand type is 'std::vector<int>') { a[++a[0]]=r%10; ^ factorialnhard.cpp:21:7: error: cannot convert 'std::vector<int>' to 'int' in assignment for(i=a[0];i>0;i--)cout<<a[i]; ^ factorialnhard.cpp:21:30: error: cannot bind 'std::ostream {aka std::basic_ostream<char>}' lvalue to 'std::basic_ostream<char>&&' for(i=a[0];i>0;i--)cout<<a[i]; ^ In file included from /usr/include/c++/4.8/iostream:39:0, from factorialnhard.cpp:2: /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) ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema FactorialnHard 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ă.