#783
Diagonale1
Se dă o matrice cu n
linii şi n
coloane şi elemente numere naturale. Să se determine suma elementelor de pe cele două diagonale vecine cu diagonala principală.
Problema | Diagonale1 | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #1501395 | Utilizator | |
Fișier | diagonale1.c | Dimensiune | 555 B |
Data încărcării | 09 Ianuarie 2016, 19:32 | Scor / rezultat | 100 puncte |
diagonale1.c: In function 'main': diagonale1.c:8:5: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'long int *' [-Wformat=] scanf("%d", &n); ^ diagonale1.c:10:6: warning: assignment from incompatible pointer type [enabled by default] a=(int**)malloc(n*sizeof(int*)); ^ diagonale1.c:11:9: warning: assignment from incompatible pointer type [enabled by default] a[0]=(int*)malloc(n*n*sizeof(int)); ^ diagonale1.c:17:9: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'long int *' [-Wformat=] scanf("%d", &a[i][j]); ^ diagonale1.c:27:5: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long int' [-Wformat=] printf("%d", S); ^ diagonale1.c:8:10: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &n); ^ diagonale1.c:17:14: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &a[i][j]); ^
Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
---|---|---|---|---|---|---|
1 | 0 secunde | OK. | 20 | 20 | Exemplu | |
2 | 0 secunde | OK. | 40 | 40 | ||
3 | 0 secunde | OK. | 40 | 40 | ||
Punctaj total | 100 |
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Diagonale1 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ă.