#216
GenMat7
Scrieţi un program care citeşte de la tastatură un număr natural n
şi construieşte în memorie o matrice cu n
linii şi n
coloane în care elementele de pe cele două diagonale sunt egale cu 0
, elementele care se află deasupra ambelor diagonale sunt egale cu 1
, elementele care se află sub ambele diagonale sunt egale cu 2
, iar restul elementelor sunt egale cu 3
.
Variante Bacalaureat 2009
Problema | GenMat7 | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #9974761 | Utilizator | |
Fișier | genmat7.c | Dimensiune | 922 B |
Data încărcării | 04 Iulie 2018, 19:12 | Scor / rezultat | 100 puncte |
genmat7.c: In function 'main': genmat7.c:3:5: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] scanf("%d",&n); ^ genmat7.c:3:5: warning: incompatible implicit declaration of built-in function 'scanf' [enabled by default] genmat7.c:5:5: warning: implicit declaration of function 'malloc' [-Wimplicit-function-declaration] int** matrice = (int**)malloc(sizeof(int*)*n); ^ genmat7.c:5:28: warning: incompatible implicit declaration of built-in function 'malloc' [enabled by default] int** matrice = (int**)malloc(sizeof(int*)*n); ^ genmat7.c:45:4: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration] printf("%d ", matrice[i - 1][j - 1]); ^ genmat7.c:45:4: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default] genmat7.c:47:3: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default] printf("\n"); ^ genmat7.c:50:3: warning: implicit declaration of function 'free' [-Wimplicit-function-declaration] free(matrice[i]); ^ genmat7.c:50:3: warning: incompatible implicit declaration of built-in function 'free' [enabled by default]
Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
---|---|---|---|---|---|---|
1 | 0 secunde | OK. | 20 | 20 | Exemplu | |
2 | 0 secunde | OK. | 20 | 20 | ||
3 | 0 secunde | OK. | 20 | 20 | ||
4 | 0 secunde | OK. | 20 | 20 | ||
5 | 0 secunde | OK. | 20 | 20 | ||
Punctaj total | 100 |
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema GenMat7 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ă.