• 沒有找到結果。

N , the origin is in the upper left corner of the table

N/A
N/A
Protected

Academic year: 2021

Share "N , the origin is in the upper left corner of the table"

Copied!
2
0
0

加載中.... (立即查看全文)

全文

(1)

10267 Graphical Editor

The simple graphical editor deals with a rectangular table M ×N (1 ≤ M, N ≤ 100). Each pixel of the table has its colour. The picture is formed from this square pixels.

The problem is to write a program, which simulates an interactive work of the graphical editor.

Input

Input consists of the editor commands, one per line. Each command is represented by one Latin capital placed in the very beginning of the line. If the command supposes parameters, all the parameters will be given in the same line separated by space. As the parameters there may be: the coordinates of the pixel - two integers, the first one is the column number and belongs to 1 . . . M , the second one is the row number and belongs to 1 . . . N , the origin is in the upper left corner of the table; the colour - the Latin capital; file name - in MSDOS 8.3 format.

The editor deals with the following commands:

I M N Creates a new table M × N. All the pixels are colored in white (O).

C Clears the table. The size remains the same. All the pixels became white (O).

L X Y C Colors the pixel with coordinates (X, Y ) in colour C.

V X Y1 Y2 C Draws the vertical segment in the column X between the rows Y1 and Y2 inclusive in colour C.

H X1 X2 Y C Draws the horizontal segment in the row Y between the columns X1 and X2 inclusive in colour C.

K X1 Y1 X2 Y2 C Draws the filled rectangle in colour C. (X1, Y1) is the upper left corner, (X2, Y2) is the lower right corner of the rectangle.

F X Y C Fills the region with the colour C. The region R to be filled is defined as follows. The pixel (X, Y ) belongs to this region.

The other pixel belongs to the region R if and only if it has the same colour as pixel (X, Y ) and a common side with any pixel which belongs to this region.

S N ame Writes the picture in the file N ame.

X Terminates the session.

Output

Every time the command ‘S N AM E’ meets, you should output the file name N AM E and the current table, row by row. Each row is represented by a pixels’ colours series, see the output sample.

Errors: If as a command there will be a character different from I, C, L, V, H, K, F, S, X, the editor should ignore the whole line and pass to the next command.

In case of other errors the program behaviour is unpredictable.

Sample Input I 5 6

L 2 3 A S one.bmp

Modified from UVA10267

(2)

Universidad de Valladolid OJ: 10267 – Graphical Editor 2/2

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

參考文獻

相關文件

♦ The action functional does not discriminate collision solutions from classical solutions...

了⼀一個方案,用以尋找滿足 Calabi 方程的空 間,這些空間現在通稱為 Calabi-Yau 空間。.

An n×n square is called an m–binary latin square if each row and column of it filled with exactly m “1”s and (n–m) “0”s. We are going to study the following question: Find

We would like to point out that unlike the pure potential case considered in [RW19], here, in order to guarantee the bulk decay of ˜u, we also need the boundary decay of ∇u due to

Al atoms are larger than N atoms because as you trace the path between N and Al on the periodic table, you move down a column (atomic size increases) and then to the left across

A subgroup N which is open in the norm topology by Theorem 3.1.3 is a group of norms N L/K L ∗ of a finite abelian extension L/K.. Then N is open in the norm topology if and only if

volume suppressed mass: (TeV) 2 /M P ∼ 10 −4 eV → mm range can be experimentally tested for any number of extra dimensions - Light U(1) gauge bosons: no derivative couplings. =>

Courtesy: Ned Wright’s Cosmology Page Burles, Nolette & Turner, 1999?. Total Mass Density