当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3013:Tetris

题目描述
Tetris is a famous puzzle video game.A random sequence of tetrominoes —shapes composed of four square blocks each—fall down the playing field (a rectangular vertical well). The object of the game is to manipulate these tetrominoes, by moving each one sideways and rotating it by 90 degree units, with the aim of creating a horizontal line of blocks without gaps. When such a line is created, it disappears, and any block above the deleted line will fall. As the game progresses, the tetrominoes fall, and the game ends when the stack of tetrominoes reaches the top of the playing field and no new tetrominoes are able to enter. Here we consider only a simple variation of tetris. The playing field consists of 20 rows and 10 columns. There’re 7 kinds of tetrominoes:

Each kind of tetrominoes may have 4 kind of rotation,ie, rotating by 0,90,180,270 degrees.Here is a sample rotation of type 2 Tetromino:

We define the initial position of a tetromino in the falling sequences as the leftmost occupied column of the tetromino after rotation. For example,for a type 2 tetromino with 180 degree rotation and a initial position of 3 is just like:


After one move down, it will look likes:

You will be given a sequence of tetrominoes with their rotation degrees and their initial position.And in this game there is no player manipulating tetrominoes. Once their rotation degree and initial position are determined,the ending of the game is unique. You just simulate as the original Tetris and are required to output the playing field right before the end of game(if the game ends before the end of sequences,you should output the the playing field right before its ends.).Note if there are some horizontal line that are fully covered by blocks,we should first delete such lines then judging the end of game.

输入解释
Input contains multiple cases.Test cases are separated by several blank lines.
Each test case starts with a integer M(1<=N<=300) ,indicating that there are M tetrominoes in the input sequence.Follow by M lines,each line contains three integers id,degree,pos(1<=id<=7,degree∈{0,90,180,270},1<=pos<=10),as described before.It guarantees that their inputs are legal.
输出解释
For each test case, output the playing field right before the end of game.ie,the playing field right before entering the last tetromino.For output,you should add a boarder to the playing field and output the rows in decreasing order,ie first output Row 20, then Row 19 and so on.If a block is occupied ,output “[]”,otherwise you should ouput '..' . Output a blank line after each Case.You may refer to the sample output for more details.
输入样例
10
3 90 1
6 270 2
5 90 1
4 90 1
7 90 5
1 0 7
1 0 7
1 0 7
3 90 4
2 90 3
输出样例
+--------------------+
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|....................|
|[][]................|
|[][][][]............|
|[]..[][]............|
|[][][][]............|
|[][][]..[][][][][][]|
|[][][]..[]..[][][][]|
+--------------------+
来自杭电HDUOJ的附加信息
Recommend gaojie

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-3013

最后修改于 2020-10-25T22:59:12+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)