#4678
MatrixReord
Vi se dă o matrice cu n
linii și m
coloane care memorează numere naturale. Să se reordoneze elementele de pe fiecare linie astfel încât numerele impare să se afle în ordine crescătoare la începutul liniei, iar numerele pare, de asemenea în ordine crescătoare, la sfârșitul liniei.
Folclorul informatic
Problema | MatrixReord | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #55088203 | Utilizator | |
Fișier | matrixreord.cpp | Dimensiune | 727 B |
Data încărcării | 21 Decembrie 2024, 21:51 | Scor / rezultat | Eroare de compilare |
matrixreord.cpp:2:21: warning: extra tokens at end of #include directive [enabled by default] #include <iostream> using namespace std; ^ matrixreord.cpp:15:60: warning: missing terminating " character [enabled by default] for(int i=0;i<n;i++){ for (int j=0;j<m;j++) cout<<a[i][3]<<" ^ matrixreord.cpp:15:1: error: missing terminating " character for(int i=0;i<n;i++){ for (int j=0;j<m;j++) cout<<a[i][3]<<" ^ matrixreord.cpp: In function 'int main()': matrixreord.cpp:3:23: error: 'cin' was not declared in this scope int main() { int n,m; cin>>n>>m; ^ matrixreord.cpp:3:23: note: suggested alternative: In file included from matrixreord.cpp:2:0: /usr/include/c++/4.8/iostream:60:18: note: 'std::cin' extern istream cin; /// Linked to standard input ^ matrixreord.cpp:5:14: error: expected initializer before '-' token int numImpare-0, numPare=0; for (int j=0;j<m;j++){ cin>>a[i][j]; if(a[i][j]%2==1) ^ matrixreord.cpp:6:1: error: expected primary-expression before '}' token } ^ matrixreord.cpp:6:1: error: expected ';' before '}' token matrixreord.cpp:7:8: error: 'num' was not declared in this scope impare[num Impare++]=a[i][j]; else pare[numPare++]=a[i][j]; ^ matrixreord.cpp:7:12: error: expected ']' before 'Impare' impare[num Impare++]=a[i][j]; else pare[numPare++]=a[i][j]; ^ matrixreord.cpp:7:12: error: expected ';' before 'Impare' matrixreord.cpp:7:31: error: 'else' without a previous 'if' impare[num Impare++]=a[i][j]; else pare[numPare++]=a[i][j]; ^ matrixreord.cpp:7:41: error: 'numPare' was not declared in this scope impare[num Impare++]=a[i][j]; else pare[numPare++]=a[i][j]; ^ matrixreord.cpp:7:57: error: 'j' was not declared in this scope impare[num Impare++]=a[i][j]; else pare[numPare++]=a[i][j]; ^ matrixreord.cpp:8:16: error: 'numImpare' was not declared in this scope for(int x=0; x<numImpare-1; x++) for (int y=x+1;y<numImpare; y++) if(impare[x]>impare[y]) ^ matrixreord.cpp:9:26: error: 'swap' was not declared in this scope swap(impare[x], impare[y]); ^ matrixreord.cpp:9:26: note: suggested alternatives: 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 matrixreord.cpp:2: /usr/include/c++/4.8/bits/basic_string.h:2717:5: note: 'std::swap' swap(basic_string<_CharT, _Traits, _Alloc>& __lhs, ^ In file included from /usr/include/c++/4.8/exception:152:0, from /usr/include/c++/4.8/ios:39, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from matrixreord.cpp:2: /usr/include/c++/4.8/bits/exception_ptr.h:160:5: note: 'std::__exception_ptr::swap' swap(exception_ptr& __lhs, exception_ptr& __rhs) ^ matrixreord.cpp:11:5: warning: unused variable 'index' [-Wunused-variable] int index=0; ^ matrixreord.cpp:12:12: error: 'x' was not declared in this scope swap (pare[x], pare[y]); ^ matrixreord.cpp:12:21: error: 'y' was not declared in this scope swap (pare[x], pare[y]); ^ matrixreord.cpp:12:23: error: 'swap' was not declared in this scope swap (pare[x], pare[y]); ^ matrixreord.cpp:12:23: note: suggested alternatives: 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 matrixreord.cpp:2: /usr/include/c++/4.8/bits/basic_string.h:2717:5: note: 'std::swap' swap(basic_string<_CharT, _Traits, _Alloc>& __lhs, ^ In file included from /usr/include/c++/4.8/exception:152:0, from /usr/include/c++/4.8/ios:39, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from matrixreord.cpp:2: /usr/include/c++/4.8/bits/exception_ptr.h:160:5: note: 'std::__exception_ptr::swap' swap(exception_ptr& __lhs, exception_ptr& __rhs) ^ matrixreord.cpp:13:16: error: 'numImpare' was not declared in this scope for(int x=0; x<numImpare; x++) a[i][index++]=impare[x]; ^ matrixreord.cpp:13:37: error: 'index' was not declared in this scope for(int x=0; x<numImpare; x++) a[i][index++]=impare[x]; ^ matrixreord.cpp:14:35: error: 'index' was not declared in this scope for(int x=0; x<numPare; x++) a[i][index++]=pare[x]; ^ matrixreord.cpp:15:45: error: 'cout' was not declared in this scope for(int i=0;i<n;i++){ for (int j=0;j<m;j++) cout<<a[i][3]<<" ^ matrixreord.cpp:15:45: note: suggested alternative: In file included from matrixreord.cpp:2:0: /usr/include/c++/4.8/iostream:61:18: note: 'std::cout' extern ostream cout; /// Linked to standard output ^ matrixreord.cpp:16:7: error: 'endl' was not declared in this scope cout<<endl; ^ matrixreord.cpp:16:7: note: suggested alternative: In file included from /usr/include/c++/4.8/iostream:39:0, from matrixreord.cpp:2: /usr/include/c++/4.8/ostream:564:5: note: 'std::endl' endl(basic_ostream<_CharT, _Traits>& __os) ^ matrixreord.cpp:19:1: error: expected '}' at end of input } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema MatrixReord 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ă.