#2835
Scrieţi un program care citește de la tastatură un număr natural, n (n∈[2,20]), apoi n numere naturale din intervalul [0,104], reprezentând, de la stânga la dreapta, în această ordine, valorile elementelor aflate pe prima linie a unui tablou bidimensional cu n linii și n coloane. Programul construiește în memorie tabloul, inițializând celelalte elemente, astfel încât fiecare linie să se obțină prin permutarea circulară a elementelor liniei
anterioare, de la stânga spre dreapta, cu o poziție.
Programul afişează pe ecran tabloul obținut, fiecare linie a tabloului pe câte o linie a ecranului, elementele de pe aceeași linie fiind separate prin câte un spațiu.
Subiect Bacalaureat 2015, sesiunea iunie-iulie
| Problema | GenMat26 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64926633 | Utilizator | |
| Fișier | genmat26.cpp | Dimensiune | 472 B |
| Data încărcării | 15 Iunie 2026, 07:23 | Scor/rezultat | Eroare de compilare |
genmat26.cpp: In function ‘int main()’: genmat26.cpp:13:28: error: expected primary-expression before ‘}’ token 13 | for (i = 1; i < n; i++) } | ^ genmat26.cpp: At global scope: genmat26.cpp:14:7: error: ‘a’ does not name a type 14 | a[i][0] = a[i-1][n-1]; | ^ genmat26.cpp:15:7: error: expected unqualified-id before ‘for’ 15 | for (j = 1; j < n; j++) } | ^~~ genmat26.cpp:15:19: error: ‘j’ does not name a type 15 | for (j = 1; j < n; j++) } | ^ genmat26.cpp:15:26: error: ‘j’ does not name a type 15 | for (j = 1; j < n; j++) } | ^ genmat26.cpp:15:31: error: expected declaration before ‘}’ token 15 | for (j = 1; j < n; j++) } | ^ genmat26.cpp:16:10: error: ‘a’ does not name a type 16 | a[i][j] = a[i-1][j-1]; | ^ genmat26.cpp:17:8: error: expected declaration before ‘}’ token 17 | } | ^ genmat26.cpp:18:4: error: expected declaration before ‘}’ token 18 | } | ^ genmat26.cpp:20:4: error: expected unqualified-id before ‘for’ 20 | for (i = 0; i < n; i++) } | ^~~ genmat26.cpp:20:16: error: ‘i’ does not name a type 20 | for (i = 0; i < n; i++) } | ^ genmat26.cpp:20:23: error: ‘i’ does not name a type 20 | for (i = 0; i < n; i++) } | ^ genmat26.cpp:20:28: error: expected declaration before ‘}’ token 20 | for (i = 0; i < n; i++) } | ^ genmat26.cpp:21:7: error: expected unqualified-id before ‘for’ 21 | for (j = 0; j < n; j++) } | ^~~ genmat26.cpp:21:19: error: ‘j’ does not name a type 21 | for (j = 0; j < n; j++) } | ^ genmat26.cpp:21:26: error: ‘j’ does not name a type 21 | for (j = 0; j < n; j++) } | ^ genmat26.cpp:21:31: error: expected declaration before ‘}’ token 21 | for (j = 0; j < n; j++) } | ^ genmat26.cpp:22:10: error: ‘cout’ does not name a type 22 | cout << a[i][j] << " "; | ^~~~ genmat26.cpp:23:8: error: expected declaration before ‘}’ token 23 | } | ^ genmat26.cpp:24:7: error: ‘cout’ does not name a type 24 | cout << endl; | ^~~~ genmat26.cpp:25:4: error: expected declaration before ‘}’ token 25 | } | ^ genmat26.cpp:27:5: error: expected unqualified-id before ‘return’ 27 | return 0; | ^~~~~~ genmat26.cpp:28:1: error: expected declaration before ‘}’ token 28 | } | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema GenMat26 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ă.