a681: Punched Cards
Tags :
Accepted rate : 25人/28人 ( 89% ) [非即時]
評分方式:
Tolerant

最近更新 : 2022-04-04 08:28

Content

A secret team of programmers is plotting to disrupt the programming language landscape and bring punched cards back by introducing a new language called Punched Card Python that lets people code in Python using punched cards! Like good disrupters, they are going to launch a viral campaign to promote their new language before even having the design for a prototype. For the campaign, they want to draw punched cards of different sizes in ASCII art.

The ASCII art of a punched card they want to draw is similar to an R×CR×C matrix without the top-left cell. That means, it has (R⋅C)−1(R⋅C)−1 cells in total. Each cell is drawn in ASCII art as a period (.) surrounded by dashes (-) above and below, pipes (|) to the left and right, and plus signs (+) for each corner. Adjacent cells share the common characters in the border. Periods (.) are used to align the cells in the top row.

For example, the following is a punched card with R=3R=3 rows and C=4C=4 columns:

 

..+-+-+-+
..|.|.|.|
+-+-+-+-+
|.|.|.|.|
+-+-+-+-+
|.|.|.|.|
+-+-+-+-+

 

There are more examples with other sizes in the samples below. Given the integers RR and CC describing the size of a punched card, print the ASCII art drawing of it as described above.

Input

The first line of the input gives the number of test cases, TT. TT lines follow, each describing a different test case with two integers RR and CC: the number of rows and columns of the punched card that must be drawn.

Output

For each test case, output one line containing Case #xx:, where xx is the test case number (starting from 1). Then, output (2⋅R)+1(2⋅R)+1 additional lines with the ASCII art drawing of a punched card with RR rows and CC columns.

Sample Input #1
3
3 4
2 2
2 3
Sample Output #1
Case #1:
..+-+-+-+
..|.|.|.|
+-+-+-+-+
|.|.|.|.|
+-+-+-+-+
|.|.|.|.|
+-+-+-+-+
Case #2:
..+-+
..|.|
+-+-+
|.|.|
+-+-+
Case #3:
..+-+-+
..|.|.|
+-+-+-+
|.|.|.|
+-+-+-+
測資資訊:
記憶體限制: 64 MB
公開 測資點#0 (50%): 1.0s , <1K
公開 測資點#1 (50%): 1.0s , <1K
Hint :
Tags:
出處:
[管理者:
ricky (電腦黃)
]


ID User Problem Subject Hit Post Date
沒有發現任何「解題報告」