#206
Scrieţi un program care citeşte de la tastatură două numere naturale nenule n şi m şi care construieşte în memorie şi apoi afişează o matrice A cu n linii (numerotate de la 1 la n) şi m coloane (numerotate de la 1 la m) cu proprietatea că fiecare element Aij memorează cea mai mică dintre valorile indicilor i şi j.
Variante Bacalaureat 2009
| Problema | GenMat1 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64710103 | Utilizator | |
| Fișier | genmat1.cpp | Dimensiune | 327 B |
| Data încărcării | 25 Mai 2026, 13:48 | Scor/rezultat | Eroare de compilare |
genmat1.cpp: In function ‘int main()’: genmat1.cpp:11:8: error: ‘i’ was not declared in this scope 11 | if(i<j); | ^ genmat1.cpp:11:10: error: ‘j’ was not declared in this scope 11 | if(i<j); | ^ genmat1.cpp:12:7: error: ‘i’ was not declared in this scope 12 | a[i][j]=i; | ^ genmat1.cpp:12:10: error: ‘j’ was not declared in this scope 12 | a[i][j]=i; | ^ genmat1.cpp:13:5: error: ‘else’ without a previous ‘if’ 13 | else; | ^~~~ genmat1.cpp: At global scope: genmat1.cpp:16:1: error: expected unqualified-id before ‘for’ 16 | for(int i=1;i<=n;i++); | ^~~ genmat1.cpp:16:13: error: ‘i’ does not name a type 16 | for(int i=1;i<=n;i++); | ^ genmat1.cpp:16:18: error: ‘i’ does not name a type 16 | for(int i=1;i<=n;i++); | ^ genmat1.cpp:17:5: error: expected unqualified-id before ‘for’ 17 | for(int j=i;j<=m;j++); | ^~~ genmat1.cpp:17:17: error: ‘j’ does not name a type 17 | for(int j=i;j<=m;j++); | ^ genmat1.cpp:17:22: error: ‘j’ does not name a type 17 | for(int j=i;j<=m;j++); | ^ genmat1.cpp:18:1: error: ‘cout’ does not name a type 18 | cout<<a[i][j]<<" "; | ^~~~ genmat1.cpp:19:1: error: ‘cout’ does not name a type 19 | cout<<endl; | ^~~~ genmat1.cpp:20:1: error: expected declaration before ‘}’ token 20 | } | ^ genmat1.cpp:22:5: error: expected unqualified-id before ‘return’ 22 | return 0; | ^~~~~~ genmat1.cpp:23:1: error: expected declaration before ‘}’ token 23 | } | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema GenMat1 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ă.