#225
Scrieţi un program care citeşte de la tastatură doua numere naturale n şi k şi construieşte în memorie o matrice cu n linii şi n coloane formată numai din valori 1, 2, 3 şi 4 astfel încât: elementele aflate la intersecţia primelor k linii cu primele k coloane sunt egale cu 1, elementele aflate la intersecţia primelor k linii cu ultimele n-k coloane sunt egale cu 2, elementele aflate la intersecţia ultimelor n-k linii cu primele k coloane sunt egale cu 3, elementele aflate la intersecţia ultimelor n-k linii cu ultimele n-k coloane sunt egale cu 4.
Variante Bacalaureat 2009
| Problema | GenMat12 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64193251 | Utilizator | |
| Fișier | genmat12.cpp | Dimensiune | 513 B |
| Data încărcării | 22 Aprilie 2026, 12:00 | Scor/rezultat | 0 puncte |
genmat12.cpp: In function ‘int main()’: genmat12.cpp:8:14: warning: suggest parentheses around comparison in operand of ‘&’ [-Wparentheses] 8 | if(i < k & j < k) | ~~^~~ genmat12.cpp:10:14: warning: suggest parentheses around comparison in operand of ‘&’ [-Wparentheses] 10 | if(i < k & j > k) | ~~^~~ genmat12.cpp:12:14: warning: suggest parentheses around comparison in operand of ‘&’ [-Wparentheses] 12 | if(i <= k & j > k) | ~~^~~~ genmat12.cpp:14:14: warning: suggest parentheses around comparison in operand of ‘&’ [-Wparentheses] 14 | if(i > k & j > k) | ~~^~~ genmat12.cpp:17:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 17 | for(int j = 0 ; j < n ; j++) | ^~~ genmat12.cpp:19:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 19 | cout << endl;} | ^~~~
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.001 secunde | Raspuns gresit. | 20 | 0 | Exemplu | |
| 2 | 0.002 secunde | Raspuns gresit. | 40 | 0 | ||
| 3 | 0.001 secunde | Raspuns gresit. | 40 | 0 | ||
| Punctaj total | 0 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema GenMat12 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ă.