#1421
După cum probabil ştiţi, contabilii îşi ţin datele sub formă de tabele şi calculează tot felul de sume pe linii şi pe coloane. Contabilul nostru Atnoc şi-a organizat valorile sub forma unui tabel cu n linii (numerotate de la 1 la n) şi m coloane (numerotate de la 1 la m). Elementele de pe ultima coloană sunt sumele elementelor de pe linii (mai exact, elementul de pe linia i şi coloana m este egal cu suma elementelor de pe linia i aflate pe coloanele 1, 2, …, m-1), iar elementele de pe ultima linie sunt sumele elementelor de pe coloane (mai exact, elementul de pe linia n şi coloana i este egal cu suma elementelor de pe coloana i aflate pe liniile 1, 2, …, n-1).
OJI 2005, clasa a VII-a
| Problema | tabel | Operații I/O |
tabel.in/tabel.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 2 MB
/
Stivă 1 MB
|
| Id soluție | #62684945 | Utilizator | |
| Fișier | tabel.cpp | Dimensiune | 1.18 KB |
| Data încărcării | 29 Ianuarie 2026, 14:56 | Scor/rezultat | Eroare de compilare |
tabel.cpp:6:1: error: 'll' does not name a type ll n, m, k, x, y, v, a[51][51], i, j, sum, cnt; ^ tabel.cpp: In function 'int main()': tabel.cpp:11:12: error: 'n' was not declared in this scope cin >> n >> m >> k; ^ tabel.cpp:11:17: error: 'm' was not declared in this scope cin >> n >> m >> k; ^ tabel.cpp:11:22: error: 'k' was not declared in this scope cin >> n >> m >> k; ^ tabel.cpp:12:10: error: 'i' was not declared in this scope for (i = 0; i < 51; i++) ^ tabel.cpp:13:14: error: 'j' was not declared in this scope for (j = 0;j < 51; j++) ^ tabel.cpp:14:13: error: 'a' was not declared in this scope a[i][j]=-1; ^ tabel.cpp:15:10: error: 'i' was not declared in this scope for (i = 1; i <=k; i++) { ^ tabel.cpp:16:16: error: 'x' was not declared in this scope cin >> x >> y>>v; ^ tabel.cpp:16:21: error: 'y' was not declared in this scope cin >> x >> y>>v; ^ tabel.cpp:16:24: error: 'v' was not declared in this scope cin >> x >> y>>v; ^ tabel.cpp:17:9: error: 'a' was not declared in this scope a[x][y]=v; ^ tabel.cpp:21:8: error: 'i' was not declared in this scope for (i = 1; i<= n; i++) { ^ tabel.cpp:22:4: error: 'cnt' was not declared in this scope cnt = 0, sum = 0, x= 0, y = 0; ^ tabel.cpp:22:13: error: 'sum' was not declared in this scope cnt = 0, sum = 0, x= 0, y = 0; ^ tabel.cpp:22:22: error: 'x' was not declared in this scope cnt = 0, sum = 0, x= 0, y = 0; ^ tabel.cpp:22:28: error: 'y' was not declared in this scope cnt = 0, sum = 0, x= 0, y = 0; ^ tabel.cpp:23:9: error: 'j' was not declared in this scope for (j = 1; j < m; j++) ^ tabel.cpp:24:9: error: 'a' was not declared in this scope if (a[i][j]==-1) cnt++,x=i,y=j; ^ tabel.cpp:27:7: error: 'a' was not declared in this scope if(a[i][m]>-1 && cnt==1) ^ tabel.cpp:32:8: error: 'j' was not declared in this scope for (j = 1; j <= m; j++) { ^ tabel.cpp:33:4: error: 'cnt' was not declared in this scope cnt = 0, sum = 0, x = 0, y=0; ^ tabel.cpp:33:13: error: 'sum' was not declared in this scope cnt = 0, sum = 0, x = 0, y=0; ^ tabel.cpp:33:22: error: 'x' was not declared in this scope cnt = 0, sum = 0, x = 0, y=0; ^ tabel.cpp:33:29: error: 'y' was not declared in this scope cnt = 0, sum = 0, x = 0, y=0; ^ tabel.cpp:34:9: error: 'i' was not declared in this scope for (i = 1; i < n; i++) ^ tabel.cpp:35:9: error: 'a' was not declared in this scope if (a[i][j]==-1) ^ tabel.cpp:40:8: error: 'a' was not declared in this scope if (a[n][j]>-1&&cnt==1) ^ tabel.cpp:48:10: error: 'i' was not declared in this scope for (i = 1; i <= n; i++) { ^ tabel.cpp:49:14: error: 'j' was not declared in this scope for (j = 1; j <= m; j++) ^ tabel.cpp:50:21: error: 'a' was not declared in this scope cout << a[i][j] << ' '; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema tabel 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ă.