#1687
Omogene
Se consideră o matrice cu L
linii și C
coloane care memorează doar valori din mulțimea {0,1,2}
. O submatrice nevidă (formată din cel puțin o linie și cel puțin o coloană) a acestei matrice o numim omogenă dacă numărul valorilor de 0
este egal cu numărul de valori de 1
și egal cu numărul valorilor de 2
.
Să se determine câte submatrice nevide omogene există.
ONI 2016, clasa a IX-a
Problema | Omogene | Operații I/O |
omogene.in /omogene.out
|
---|---|---|---|
Limita timp | 1.3 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #50518868 | Utilizator | |
Fișier | omogene.cpp | Dimensiune | 1.42 KB |
Data încărcării | 12 Aprilie 2024, 15:56 | Scor / rezultat | Eroare de compilare |
omogene.cpp:13:32: error: 'short int j1' redeclared as different kind of symbol short int num0,num1,num2,i1,i2,j1,j2; ^ In file included from /usr/include/features.h:374:0, from /usr/include/assert.h:35, from /usr/include/c++/4.8/cassert:43, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:33, from omogene.cpp:1: /usr/include/i386-linux-gnu/bits/mathcalls.h:238:1: error: previous declaration of 'double j1(double)' __MATHCALL (j1,, (_Mdouble_)); ^ omogene.cpp: In function 'int main()': omogene.cpp:34:15: error: assignment of function 'double j1(double)' for(j1=1;j1<=c;j1++){ ^ omogene.cpp:34:15: error: cannot convert 'int' to 'double(double)throw ()' in assignment omogene.cpp:34:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] for(j1=1;j1<=c;j1++){ ^ omogene.cpp:34:26: error: ISO C++ forbids incrementing a pointer of type 'double (*)(double)throw ()' [-fpermissive] for(j1=1;j1<=c;j1++){ ^ omogene.cpp:34:26: error: lvalue required as increment operand omogene.cpp:36:23: error: invalid conversion from 'double (*)(double)throw ()' to 'short int' [-fpermissive] for(j2=j1;j2<=c;j2++){ ^ omogene.cpp:37:66: warning: pointer to a function used in arithmetic [-Wpointer-arith] num0=mat0[i2][j2]-mat0[i1-1][j2]-mat0[i2][j1-1]+mat0[i1-1][j1-1]; ^ omogene.cpp:37:67: error: invalid types 'short int [5002][double (*)(double)throw ()]' for array subscript num0=mat0[i2][j2]-mat0[i1-1][j2]-mat0[i2][j1-1]+mat0[i1-1][j1-1]; ^ omogene.cpp:37:83: warning: pointer to a function used in arithmetic [-Wpointer-arith] num0=mat0[i2][j2]-mat0[i1-1][j2]-mat0[i2][j1-1]+mat0[i1-1][j1-1]; ^ omogene.cpp:37:84: error: invalid types 'short int [5002][double (*)(double)throw ()]' for array subscript num0=mat0[i2][j2]-mat0[i1-1][j2]-mat0[i2][j1-1]+mat0[i1-1][j1-1]; ^ omogene.cpp:38:66: warning: pointer to a function used in arithmetic [-Wpointer-arith] num1=mat1[i2][j2]-mat1[i1-1][j2]-mat1[i2][j1-1]+mat1[i1-1][j1-1]; ^ omogene.cpp:38:67: error: invalid types 'short int [5002][double (*)(double)throw ()]' for array subscript num1=mat1[i2][j2]-mat1[i1-1][j2]-mat1[i2][j1-1]+mat1[i1-1][j1-1]; ^ omogene.cpp:38:83: warning: pointer to a function used in arithmetic [-Wpointer-arith] num1=mat1[i2][j2]-mat1[i1-1][j2]-mat1[i2][j1-1]+mat1[i1-1][j1-1]; ^ omogene.cpp:38:84: error: invalid types 'short int [5002][double (*)(double)throw ()]' for array subscript num1=mat1[i2][j2]-mat1[i1-1][j2]-mat1[i2][j1-1]+mat1[i1-1][j1-1]; ^ omogene.cpp:39:66: warning: pointer to a function used in arithmetic [-Wpointer-arith] num2=mat2[i2][j2]-mat2[i1-1][j2]-mat2[i2][j1-1]+mat2[i1-1][j1-1]; ^ omogene.cpp:39:67: error: invalid types 'short int [5002][double (*)(double)throw ()]' for array subscript num2=mat2[i2][j2]-mat2[i1-1][j2]-mat2[i2][j1-1]+mat2[i1-1][j1-1]; ^ omogene.cpp:39:83: warning: pointer to a function used in arithmetic [-Wpointer-arith] num2=mat2[i2][j2]-mat2[i1-1][j2]-mat2[i2][j1-1]+mat2[i1-1][j1-1]; ^ omogene.cpp:39:84: error: invalid types 'short int [5002][double (*)(double)throw ()]' for array subscript num2=mat2[i2][j2]-mat2[i1-1][j2]-mat2[i2][j1-1]+mat2[i1-1][j1-1]; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Omogene 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ă.