#313
Diagonale
Se dă o matrice cu n
linii și n
coloane și elemente numere naturale. Calculați diferența în valoare absolută dintre sumele elementelor de pe cele două diagonale.
Problema | Diagonale | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #49334353 | Utilizator | |
Fișier | diagonale.cpp | Dimensiune | 398 B |
Data încărcării | 26 Februarie 2024, 18:11 | Scor / rezultat | Eroare de compilare |
diagonale.cpp: In function 'int main()': diagonale.cpp:4:11: error: expected initializer before 'n' {int main n,m,i,j,a[101][101],s1=0,s2=0,D; ^ diagonale.cpp:5:7: error: 'n' was not declared in this scope cin>>n>>m; ^ diagonale.cpp:5:10: error: 'm' was not declared in this scope cin>>n>>m; ^ diagonale.cpp:7:27: error: 'a' was not declared in this scope for(int j=1;j<=n;j++)cin>>a[i][j]; ^ diagonale.cpp:11:6: error: 's1' was not declared in this scope s1=s1=a[i][j]; ^ diagonale.cpp:11:12: error: 'a' was not declared in this scope s1=s1=a[i][j]; ^ diagonale.cpp:12:9: error: 'i' was not declared in this scope if(i+j==n+1) ^ diagonale.cpp:12:11: error: 'j' was not declared in this scope if(i+j==n+1) ^ diagonale.cpp:13:6: error: 's2' was not declared in this scope s2=s2+a[i][j]; ^ diagonale.cpp:13:12: error: 'a' was not declared in this scope s2=s2+a[i][j]; ^ diagonale.cpp:14:4: error: 's1' was not declared in this scope if(s1>s2) ^ diagonale.cpp:14:7: error: 's2' was not declared in this scope if(s1>s2) ^ diagonale.cpp:15:6: error: 'D' was not declared in this scope D=s1-s2; ^ diagonale.cpp:17:6: error: 'D' was not declared in this scope D=s2-s1; ^ diagonale.cpp:18:12: error: 'D' was not declared in this scope cout<<D; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Diagonale 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ă.