#939
sum00
Să se scrie un program care citeşte de la tastatura două numere naturale şi determină suma lor.
Problema | sum00 | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #32013958 | Utilizator | |
Fișier | sum00.cpp | Dimensiune | 1016 B |
Data încărcării | 02 Noiembrie 2021, 13:16 | Scor / rezultat | Eroare de compilare |
sum00.cpp: In function 'int main()': sum00.cpp:30:10: error: no match for 'operator=' (operand types are 'std::pair<int, int>' and '<unresolved overloaded function type>') p=b.back;b.pop_back(); ^ sum00.cpp:30:10: note: candidates are: In file included from /usr/include/c++/4.8/bits/stl_algobase.h:64:0, from /usr/include/c++/4.8/bits/char_traits.h:39, 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 sum00.cpp:1: /usr/include/c++/4.8/bits/stl_pair.h:158:7: note: std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(const std::pair<_T1, _T2>&) [with _T1 = int; _T2 = int] operator=(const pair& __p) ^ /usr/include/c++/4.8/bits/stl_pair.h:158:7: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const std::pair<int, int>&' /usr/include/c++/4.8/bits/stl_pair.h:166:7: note: std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(std::pair<_T1, _T2>&&) [with _T1 = int; _T2 = int] operator=(pair&& __p) ^ /usr/include/c++/4.8/bits/stl_pair.h:166:7: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::pair<int, int>&&' /usr/include/c++/4.8/bits/stl_pair.h:177:2: note: template<class _U1, class _U2> std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(const std::pair<_U1, _U2>&) [with _U1 = _U1; _U2 = _U2; _T1 = int; _T2 = int] operator=(const pair<_U1, _U2>& __p) ^ /usr/include/c++/4.8/bits/stl_pair.h:177:2: note: template argument deduction/substitution failed: sum00.cpp:30:10: note: 'const value_type& (std::vector<std::pair<int, int> >::*)()const {aka const std::pair<int, int>& (std::vector<std::pair<int, int> >::*)()const}' is not derived from 'const std::pair<_T1, _T2>' p=b.back;b.pop_back(); ^ sum00.cpp:30:10: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> > >::value_type& (std::vector<std::pair<int, int> >::*)() {aka std::pair<int, int>& (std::vector<std::pair<int, int> >::*)()}' is not derived from 'const std::pair<_T1, _T2>' sum00.cpp:30:10: note: could not resolve address from overloaded function 'b.std::vector<std::pair<int, int> >::back' In file included from /usr/include/c++/4.8/bits/stl_algobase.h:64:0, from /usr/include/c++/4.8/bits/char_traits.h:39, 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 sum00.cpp:1: /usr/include/c++/4.8/bits/stl_pair.h:186:2: note: template<class _U1, class _U2> std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(std::pair<_U1, _U2>&&) [with _U1 = _U1; _U2 = _U2; _T1 = int; _T2 = int] operator=(pair<_U1, _U2>&& __p) ^ /usr/include/c++/4.8/bits/stl_pair.h:186:2: note: template argument deduction/substitution failed: sum00.cpp:30:10: note: 'const value_type& (std::vector<std::pair<int, int> >::*)()const {aka const std::pair<int, int>& (std::vector<std::pair<int, int> >::*)()const}' is not derived from 'std::pair<_T1, _T2>' p=b.back;b.pop_back(); ^ sum00.cpp:30:10: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> > >::value_type& (std::vector<std::pair<int, int> >::*)() {aka std::pair<int, int>& (std::vector<std::pair<int, int> >::*)()}' is not derived from 'std::pair<_T1, _T2>' sum00.cpp:30:10: note: could not resolve address from overloaded function 'b.std::vector<std::pair<int, int> >::back' sum00.cpp:14:36: error: 'c' was not declared in this scope #define v(x,y)if(a[x][y]==a[i][j]&&c[x][y]==0)c[x][y]=l,b.push_back(make_pair(x,y)); ^ sum00.cpp:31:9: note: in expansion of macro 'v' v(p.first+1,p.second); ^ sum00.cpp:14:36: error: 'c' was not declared in this scope #define v(x,y)if(a[x][y]==a[i][j]&&c[x][y]==0)c[x][y]=l,b.push_back(make_pair(x,y)); ^ sum00.cpp:32:9: note: in expansion of macro 'v' v(p.first-1,p.second); ^ sum00.cpp:14:36: error: 'c' was not declared in this scope #define v(x,y)if(a[x][y]==a[i][j]&&c[x][y]==0)c[x][y]=l,b.push_back(make_pair(x,y)); ^ sum00.cpp:33:9: note: in expansion of macro 'v' v(p.first,p.second+1); ^ sum00.cpp:14:36: error: 'c' was not declared in this scope #define v(x,y)if(a[x][y]==a[i][j]&&c[x][y]==0)c[x][y]=l,b.push_back(make_pair(x,y)); ^ sum00.cpp:34:9: note: in expansion of macro 'v' v(p.first,p.second-1); ^ sum00.cpp:39:21: error: invalid types 'int[int]' for array subscript cout<<d[i][j]<<' ';cout<<'\n';} ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema sum00 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ă.