#786
MatSim
Se dă o matrice cu n
linii şi n
coloane şi elemente numere naturale. Să se construiască o matrice care să fie simetrica față de diagonala principală a matricei date.
Problema | MatSim | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #54926266 | Utilizator | |
Fișier | matsim.cpp | Dimensiune | 393 B |
Data încărcării | 12 Decembrie 2024, 13:00 | Scor / rezultat | Eroare de compilare |
matsim.cpp: In function 'int main()': matsim.cpp:11:35: warning: capture of variable 'i' with non-automatic storage duration [enabled by default] {if(j<i) {swap(a[i][j],a[j],[i]);}} ^ matsim.cpp:3:17: note: 'int i' declared here int a[101][101],i,j,n; ^ matsim.cpp: In lambda function: matsim.cpp:11:37: error: expected '{' before ')' token {if(j<i) {swap(a[i][j],a[j],[i]);}} ^ matsim.cpp: In function 'int main()': matsim.cpp:11:37: error: no matching function for call to 'swap(int&, int [101], main()::__lambda0)' matsim.cpp:11:37: note: candidates are: In file included from /usr/include/c++/4.8/bits/stl_pair.h:59:0, from /usr/include/c++/4.8/bits/stl_algobase.h:64, 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/ostream:38, from /usr/include/c++/4.8/iostream:39, from matsim.cpp:1: /usr/include/c++/4.8/bits/move.h:166:5: note: template<class _Tp> void std::swap(_Tp&, _Tp&) swap(_Tp& __a, _Tp& __b) ^ /usr/include/c++/4.8/bits/move.h:166:5: note: template argument deduction/substitution failed: matsim.cpp:11:37: note: deduced conflicting types for parameter '_Tp' ('int' and 'int [101]') {if(j<i) {swap(a[i][j],a[j],[i]);}} ^ In file included from /usr/include/c++/4.8/bits/stl_pair.h:59:0, from /usr/include/c++/4.8/bits/stl_algobase.h:64, 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/ostream:38, from /usr/include/c++/4.8/iostream:39, from matsim.cpp:1: /usr/include/c++/4.8/bits/move.h:185:5: note: template<class _Tp, unsigned int _Nm> void std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm]) swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) ^ /usr/include/c++/4.8/bits/move.h:185:5: note: template argument deduction/substitution failed: matsim.cpp:11:37: note: mismatched types '_Tp [_Nm]' and 'int' {if(j<i) {swap(a[i][j],a[j],[i]);}} ^ 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/ostream:38, from /usr/include/c++/4.8/iostream:39, from matsim.cpp:1: /usr/include/c++/4.8/bits/stl_pair.h:254:5: note: template<class _T1, class _T2> void std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&) swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) ^ /usr/include/c++/4.8/bits/stl_pair.h:254:5: note: template argument deduction/substitution failed: matsim.cpp:11:37: note: mismatched types 'std::pair<_T1, _T2>' and 'int' {if(j<i) {swap(a[i][j],a[j],[i]);}} ^ 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 matsim.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:2717:5: note: template<class _CharT, class _Traits, class _Alloc> void std::swap(std::basic_string<_CharT, _Traits, _Alloc>&, std::basic_string<_CharT, _Traits, _Alloc>&) swap(basic_string<_CharT, _Traits, _Alloc>& __lhs, ^ /usr/include/c++/4.8/bits/basic_string.h:2717:5: note: template argument deduction/substitution failed: matsim.cpp:11:37: note: mismatched types 'std::basic_string<_CharT, _Traits, _Alloc>' and 'int' {if(j<i) {swap(a[i][j],a[j],[i]);}} ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema MatSim 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ă.