[BOJ 14539] Grid Pattern

View as PDF

Submit solution

Points: 1
Time limit: 10.0s
Memory limit: 512M

Problem types
Allowed languages
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text

Games that are commonly found in the Unix System during the 70s and 80s are design in text mode. Grid is the basic layout for many of these games where pieces or items are positioned in rows and columns. Classic examples would be tic-tac-toe, chess and minesweeper. You are to design a simple text-based grid layout engine that can be used in the games.</p>

Given specified dimensions, print a text-based grid pattern. Use the | (pipe) sign to print vertical elements, the – (minus) to print horizontal ones and + (plus) for crossing. The rest of the spaces are filled with * (asterisk).

입력 형식

The first line of input contains a positive integer N (N ≤ 100) which indicates the number of test cases. Each of the following N lines contains four positive integers: row – the number of rows, col – the number of columns, w and h – the width and height of the single grid respectively. (1 ≤ row, col ≤ 10; 1 ≤  w, h ≤ 5 )

출력 형식

For each test case, output a line in the format "Case #x:" where x is the case number (starting from 1), follow by the grid pattern as shown in the sample output.

예제 입력

2
2 2 2 2
1 3 3 1

예제 출력

Case #1:
+--+--+
|**|**|
|**|**|
+--+--+
|**|**|
|**|**|
+--+--+
Case #2:
+---+---+---+
|***|***|***|
+---+---+---+

Comments

There are no comments at the moment.