#2066
boats
Pe o foaie de matematică cu N
pătrățele orizontale (pe aceeași linie) și M
pătrățele verticale (pe aceeași coloană), Alex a pictat nave. Definim o navă linie (L) ca un set de pătrățele umbrite, consecutive pe un rând al foii de matematică. Definim o navă coloană (C) ca un set de pătrățele umbrite, consecutive pe o coloană a foii de matematică. Dimensiunea unei nave este egală cu numărul de pătrățele din care este formată. O navă formată dintr-un singur pătrățel nu este nici linie, nici coloană. Navele pot avea diferite dimensiuni. Două nave diferite nu se ating pe laturi sau colțuri, nu se suprapun și nu au pătrățele comune. Pe foaia de matematică sunt pictate doar nave de cele 3 tipuri: navă linie (L), navă coloană (C) sau navă pătrățel.
Cunoscându-se M
, N
și pictura lui Alex, scrieți un program care să determine:
ONIGIM 2017, Clasa a VIII-a
Problema | boats | Operații I/O |
boats.in /boats.out
|
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 4 MB
/
Stivă 4 MB
|
Id soluție | #52346609 | Utilizator | |
Fișier | boats.cpp | Dimensiune | 1.27 KB |
Data încărcării | 27 Septembrie 2024, 04:44 | Scor / rezultat | Eroare de compilare |
boats.cpp:3:21: error: too many decimal points in number oriz,vert:array[1..1002] of integer; ^ boats.cpp:4:13: error: too many decimal points in number a:array[1..1003,1..1003] of integer; ^ boats.cpp:4:21: error: too many decimal points in number a:array[1..1003,1..1003] of integer; ^ boats.cpp:62:11: warning: character constant too long for its type [enabled by default] assign (f,'boats.in'); ^ boats.cpp:64:11: warning: character constant too long for its type [enabled by default] assign (g,'boats.out'); ^ boats.cpp:1:1: error: 'program' does not name a type program boats; ^ boats.cpp:2:1: error: 'var' does not name a type var n,m,p:integer; ^ boats.cpp:3:5: error: 'oriz' does not name a type oriz,vert:array[1..1002] of integer; ^ boats.cpp:4:6: error: found ':' in nested-name-specifier, expected '::' a:array[1..1003,1..1003] of integer; ^ boats.cpp:4:5: error: 'a' does not name a type a:array[1..1003,1..1003] of integer; ^ boats.cpp:5:5: error: 'f' does not name a type f,g:text; ^ boats.cpp:7:1: error: 'procedure' does not name a type procedure citire; ^ boats.cpp:8:1: error: 'var' does not name a type var i,j:integer; ^ boats.cpp:9:1: error: 'begin' does not name a type begin ^ boats.cpp:11:2: error: expected unqualified-id before 'for' for i:=1 to n do ^ boats.cpp:14:1: error: 'end' does not name a type end; ^ boats.cpp:15:1: error: 'procedure' does not name a type procedure sol; ^ boats.cpp:16:1: error: 'var' does not name a type var i,j,nr,k:integer; ^ boats.cpp:17:1: error: 'begin' does not name a type begin ^ boats.cpp:20:1: error: expected unqualified-id before 'for' for i:=1 to n do ^ boats.cpp:22:2: error: expected unqualified-id before 'for' for i:=1 to n do ^ boats.cpp:25:2: error: expected unqualified-id before 'while' while j<=m do ^ boats.cpp:31:15: error: expected unqualified-id before 'if' if a[i+1,j]=0 then ^ boats.cpp:34:17: error: expected unqualified-id before 'while' while a[i,j]=1 do ^ boats.cpp:35:51: error: 'j' does not name a type begin a[i,j]:=0; j:=j+1;nr:=nr+1;end; ^ boats.cpp:35:58: error: 'nr' does not name a type begin a[i,j]:=0; j:=j+1;nr:=nr+1;end; ^ boats.cpp:35:67: error: 'end' does not name a type begin a[i,j]:=0; j:=j+1;nr:=nr+1;end; ^ boats.cpp:36:20: error: expected constructor, destructor, or type conversion before '(' token inc(oriz[nr]);dec(j); ^ boats.cpp:36:34: error: expected constructor, destructor, or type conversion before '(' token inc(oriz[nr]);dec(j); ^ boats.cpp:37:15: error: 'end' does not name a type end ^ boats.cpp:41:17: error: expected unqualified-id before 'while' while a[k,j]=1 do ^ boats.cpp:42:55: error: expected constructor, destructor, or type conversion before '(' token begin a[k,j]:=0; inc(k);inc(nr);end; ^ boats.cpp:42:62: error: expected constructor, destructor, or type conversion before '(' token begin a[k,j]:=0; inc(k);inc(nr);end; ^ boats.cpp:42:67: error: 'end' does not name a type begin a[k,j]:=0; inc(k);inc(nr);end; ^ boats.cpp:43:20: error: expected constructor, destructor, or type conversion before '(' token inc(vert[nr]); ^ boats.cpp:44:15: error: 'end' does not name a type end; ^ boats.cpp:46:13: error: 'end' does not name a type end; ^ boats.cpp:47:1: error: 'j' does not name a type j:=j+1; ^ boats.cpp:48:1: error: 'end' does not name a type end; ^ boats.cpp:49:1: error: 'end' does not name a type end; ^ boats.cpp:50:1: error: expected unqualified-id before 'if' if p=1 then write(g,oriz[1]) ^ boats.cpp:55:5: error: expected unqualified-id before 'for' for i:=2 to n do ^ boats.cpp:57:5: error: 'end' does not name a type end; ^ boats.cpp:59:1: error: 'end' does not name a type end; ^ boats.cpp:61:1: error: 'Begin' does not name a type Begin ^ boats.cpp:63:6: error: expected constructor, destructor, or type conversion before '(' token reset(f); ^ boats.cpp:64:8: error: expected constructor, destructor, or type conversion before '(' token assign (g,'boats.out'); ^ boats.cpp:65:8: error: expected constructor, destructor, or type conversion before '(' token rewrite(g); ^ boats.cpp:66:1: error: 'citire' does not name a type citire; ^ boats.cpp:67:1: error: 'sol' does not name a type sol; ^ boats.cpp:68:6: error: expected constructor, destructor, or type conversion before '(' token close(f); ^ boats.cpp:69:6: error: expected constructor, destructor, or type conversion before '(' token close(g); ^ boats.cpp:70:1: error: 'end' does not name a type end. ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema boats 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ă.