Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Nisam siguran što se traži u zadatku ( kratko )

[es] :: Art of Programming :: Nisam siguran što se traži u zadatku ( kratko )

[ Pregleda: 1696 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

Ice-D

Član broj: 203571
Poruke: 33
*.adsl.net.t-com.hr.



Profil

icon Nisam siguran što se traži u zadatku ( kratko )24.12.2008. u 17:47 - pre 186 meseci
Code:
Input
The input consists of a sequence of editor commands, one per line. Each command is
represented by one capital letter placed as the first character of the line. If the command
needs parameters, they will be given on the same line separated by spaces.

The editor accepts the following commands:
I M N Create a new M ×N image with all pixels initially colored
white (O).
C Clear the table by setting all pixels white (O). The size
remains unchanged.
L X Y C Colors the pixel (X, Y ) in color (C).
V X Y1 Y2 C Draw a vertical segment of color (C) in column X, between
the rows Y 1 and Y 2 inclusive.
H X1 X2 Y C Draw a horizontal segment of color (C) in the row Y ,
between the columns X1 and X2 inclusive.
K X1 Y1 X2 Y2 C Draw a filled rectangle of color C, where (X1, Y 1) is the
upper-left and (X2, Y 2) the lower right corner.
F X Y C Fill the region R with the color C, where R is defined as
follows. Pixel (X, Y ) belongs to R. Any other pixel which
is the same color as pixel (X, Y ) and shares a common side
with any pixel in R also belongs to this region.
S Name Write the file name in MSDOS 8.3 format followed by the
contents of the current image.
X Terminate the session.

Ignore the entire line of any command defined by a character other than I, C, L,
V, H, K, F, S, or X, and pass on to the next command.

Sample Input
I 5 6
L 2 3 A
S one.bmp
G 2 3 J
F 3 3 J
V 2 3 4 W
H 3 4 2 Z
S two.bmp
X
Sample Output
one.bmp
OOOOO
OOOOO
OAOOO
OOOOO
OOOOO
OOOOO
two.bmp
JJJJJ
JJZZJ
JWJJJ
JWJJJ
JJJJJ
JJJJJ


Evo što mi nije jasno -> Samle Input:
I 5 6 //Napravi novi image 5x6...Ok
L 2 3 A //Postavi boju pixela x=2,y=3 na A....Ok
S one.bmp //Printaj image....Ok
G 2 3 J //G -> nepostojeća komanda...zanemari je...Ok
F 3 3 J // pixel x=3,y=3 postavi na J...Any other pixel which is the same color as pixel (X, Y ) and shares a common side with any pixel in R also
//belongs to this region.....TO BAŠ NE KUŽIM...po two.bmp ispada da sve pixele treba postaviti na J jer je x=3,y=3 bio ne postavljen kao
//i njegovi susjedi? ( common side ) a pixel x=2,y=3 boja = A nekalo se izgubi? ili što li već?

V 2 3 4 W //Napravi vertikalni segment u boji W...Ok
H 3 4 2 Z //Naoravi horizontalni segmant u boji Z...Ok
S two.bmp //Isprintaj....Ok
X //Završi...Ok
 
Odgovor na temu

jablan

Član broj: 8286
Poruke: 4541



+711 Profil

icon Re: Nisam siguran što se traži u zadatku ( kratko )24.12.2008. u 18:13 - pre 186 meseci
A se nije izgubio u toj komandi, već u sledećoj, kad je iscrtana vertikalna linija boje W.

Inače, F je klasičan 4-sided flood fill, ilustrovan i na sledećem gifu:

 
Odgovor na temu

Ice-D

Član broj: 203571
Poruke: 33
*.adsl.net.t-com.hr.



Profil

icon Re: Nisam siguran što se traži u zadatku ( kratko )24.12.2008. u 18:35 - pre 186 meseci
zahvljujem, sad mogu rješavat.
 
Odgovor na temu

[es] :: Art of Programming :: Nisam siguran što se traži u zadatku ( kratko )

[ Pregleda: 1696 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.