#743
Operatii
Fiind date două tablouri bidimensionale a
şi b
, cu m
linii şi n
coloane fiecare, definim următoarele operaţii:
1. suma tablourilor a
şi b
, ca fiind un tablou c
cu m
linii şi n
coloane, în care fiecare element este egal cu suma elementelor de pe aceeași linie şi aceeași coloană din a
şi b
. În acest caz folosim operatorul +
, adică c=a+b
.
2. produsul tablourilor a
şi b
, ca fiind un tablou d
cu m
linii şi n
coloane, în care fiecare element este egal cu produsul elementelor de pe aceeași linie şi aceeași coloană din a
şi b
. În acest caz folosim operatorul *
, adică d=a*b
. Dacă a
şi b
sunt tablouri identice (a
şi b
au elemente identice pe aceeaşi poziţie), atunci pentru d
se mai foloseşte şi notaţia a
2
sau b
2
.
De exemplu, pentru m=2
, n=3
şi tablourile:
se obține:
Fiind dat un tablou bidimensional a
, cu m
linii, n
coloane şi componente numere naturale dorim să determinăm un şir de tablouri bidimensionale: b
1
, b
2
, …, b
k
cu număr minim de termeni (k
minim), cu proprietatea că a
=b
1
2
+b
2
2
...+b
k
2
.
Lot Juniori, Bistrita, 2009
Problema | Operatii | Operații I/O |
operatii.in /operatii.out
|
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 16 MB
/
Stivă 16 MB
|
Id soluție | #52407310 | Utilizator | |
Fișier | operatii.cpp | Dimensiune | 2.16 KB |
Data încărcării | 29 Septembrie 2024, 14:54 | Scor / rezultat | Eroare de compilare |
operatii.cpp:6:15: error: too many decimal points in number a : array[1..201,1..201] of longint; ^ operatii.cpp:6:22: error: too many decimal points in number a : array[1..201,1..201] of longint; ^ operatii.cpp:7:13: error: too many decimal points in number x:array[0..nmax,0..kmax] of integer; ^ operatii.cpp:7:21: error: too many decimal points in number x:array[0..nmax,0..kmax] of integer; ^ operatii.cpp:11:12: warning: character constant too long for its type [enabled by default] assign(g,'operatii.out'); rewrite(g); ^ operatii.cpp:74:17: warning: character constant too long for its type [enabled by default] writeln('upsi la ',i); ^ operatii.cpp:77:14: warning: character constant too long for its type [enabled by default] assign(f,'operatii.in'); reset(f); ^ operatii.cpp:1:1: error: expected unqualified-id before '{' token {$r-} ^ operatii.cpp:2:7: error: 'nmax' does not name a type const nmax = 10000; ^ operatii.cpp:3:7: error: 'kmax' does not name a type kmax = 10; ^ operatii.cpp:4:1: error: 'var' does not name a type var f,g:text; ^ operatii.cpp:5:5: error: 'n1' does not name a type n1,n2,n3,aux,q,kmx,k,buf,nl,nc,i,j,sum:integer; ^ operatii.cpp:6:7: error: found ':' in nested-name-specifier, expected '::' a : array[1..201,1..201] of longint; ^ operatii.cpp:6:5: error: 'a' does not name a type a : array[1..201,1..201] of longint; ^ operatii.cpp:7:6: error: found ':' in nested-name-specifier, expected '::' x:array[0..nmax,0..kmax] of integer; ^ operatii.cpp:7:5: error: 'x' does not name a type x:array[0..nmax,0..kmax] of integer; ^ operatii.cpp:9:1: error: 'begin' does not name a type begin ^ operatii.cpp:11:9: error: expected constructor, destructor, or type conversion before '(' token assign(g,'operatii.out'); rewrite(g); ^ operatii.cpp:11:36: error: expected constructor, destructor, or type conversion before '(' token assign(g,'operatii.out'); rewrite(g); ^ operatii.cpp:12:3: error: expected unqualified-id before 'for' for i := 0 to nmax do ^ operatii.cpp:15:3: error: expected unqualified-id before 'for' for i := 1 to trunc(sqrt(nmax)) do ^ operatii.cpp:18:5: error: 'x' does not name a type x[i*i][1]:=i*i ^ operatii.cpp:21:3: error: expected unqualified-id before 'for' for i := 1 to nmax do ^ operatii.cpp:26:9: error: expected unqualified-id before 'if' if aux>0 then ^ operatii.cpp:29:24: error: 'x' does not name a type x[i][0]:=2;x[i][1]:=n1*n1;x[i][2]:=aux; break; ^ operatii.cpp:29:39: error: 'x' does not name a type x[i][0]:=2;x[i][1]:=n1*n1;x[i][2]:=aux; break; ^ operatii.cpp:29:53: error: expected unqualified-id before 'break' x[i][0]:=2;x[i][1]:=n1*n1;x[i][2]:=aux; break; ^ operatii.cpp:30:11: error: 'end' does not name a type end; ^ operatii.cpp:31:8: error: 'end' does not name a type end; ^ operatii.cpp:33:3: error: expected unqualified-id before 'for' for i := 1 to nmax do ^ operatii.cpp:40:11: error: expected unqualified-id before 'if' if trunc(sqrt(aux))=sqrt(aux) then ^ operatii.cpp:42:24: error: 'x' does not name a type x[i][0]:=3;x[i][1]:=n1*n1;x[i][2]:=n2*n2;x[i][3]:=aux; break; ^ operatii.cpp:42:39: error: 'x' does not name a type x[i][0]:=3;x[i][1]:=n1*n1;x[i][2]:=n2*n2;x[i][3]:=aux; break; ^ operatii.cpp:42:54: error: 'x' does not name a type x[i][0]:=3;x[i][1]:=n1*n1;x[i][2]:=n2*n2;x[i][3]:=aux; break; ^ operatii.cpp:42:68: error: expected unqualified-id before 'break' x[i][0]:=3;x[i][1]:=n1*n1;x[i][2]:=n2*n2;x[i][3]:=aux; break; ^ operatii.cpp:43:11: error: 'end' does not name a type end; ^ operatii.cpp:44:9: error: 'end' does not name a type end ^ operatii.cpp:48:3: error: expected unqualified-id before 'for' for i := 1 to nmax do ^ operatii.cpp:57:11: error: expected unqualified-id before 'if' if trunc(sqrt(aux))=sqrt(aux) then ^ operatii.cpp:59:24: error: 'x' does not name a type x[i][0]:=4;x[i][1]:=n1*n1;x[i][2]:=n2*n2;x[i][3]:=n3*n3; ^ operatii.cpp:59:39: error: 'x' does not name a type x[i][0]:=4;x[i][1]:=n1*n1;x[i][2]:=n2*n2;x[i][3]:=n3*n3; ^ operatii.cpp:59:54: error: 'x' does not name a type x[i][0]:=4;x[i][1]:=n1*n1;x[i][2]:=n2*n2;x[i][3]:=n3*n3; ^ operatii.cpp:60:13: error: 'x' does not name a type x[i][4]:=aux; break; ^ operatii.cpp:60:27: error: expected unqualified-id before 'break' x[i][4]:=aux; break; ^ operatii.cpp:61:11: error: 'end' does not name a type end; ^ operatii.cpp:62:9: error: 'end' does not name a type end ^ operatii.cpp:65:1: error: expected unqualified-id before '{' token { ^ operatii.cpp:77:11: error: expected constructor, destructor, or type conversion before '(' token assign(f,'operatii.in'); reset(f); ^ operatii.cpp:77:35: error: expected constructor, destructor, or type conversion before '(' token assign(f,'operatii.in'); reset(f); ^ operatii.cpp:79:9: error: expected constructor, destructor, or type conversion before '(' token readln(f,nl,nc); ^ operatii.cpp:80:3: error: expected unqualified-id before 'for' for i := 1 to nl do ^ operatii.cpp:84:8: error: expected unqualified-id before 'if' if x[buf][0]>kmx then ^ operatii.cpp:86:8: error: 'a' does not name a type a[i][j] := buf; ^ operatii.cpp:87:6: error: 'end' does not name a type end; ^ operatii.cpp:88:8: error: expected constructor, destructor, or type conversion before '(' token close(f); ^ operatii.cpp:91:10: error: expected constructor, destructor, or type conversion before '(' token writeln(g,kmx); ^ operatii.cpp:93:3: error: expected unqualified-id before 'for' for k := 1 to kmx do ^ operatii.cpp:98:16: error: expected constructor, destructor, or type conversion before '(' token writeln(g) ^ operatii.cpp:101:8: error: expected constructor, destructor, or type conversion before '(' token close(g); ^ operatii.cpp:102:1: error: 'end' does not name a type end. ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Operatii 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ă.