Submit | All submissions | Best solutions | Back to list |
HEXBOARD - Hexagonal Board |
Square boards (as the chessboard) are really common among games and luckily, they are easy to draw with the help of a ruler. However, there exist other games that require hexagonal boards, that are much harder to draw by hand.
The Institute for Client Permanent Comfort (ICPC) of a famous board game factory has decided to provide their customers with an automated program to build hexagonal boards for several games. The size of an hexagonal board is determined by a single integer N that indicates how many cells there are in each of the 6 sides of the board. For example, a board of size N = 2 should look as follows when drawn by the program.
_ _/ \_ / \_/ \ \_/ \_/ / \_/ \ \_/ \_/ \_/
Your task is to help ICPC in making the program.
Input
The input contains several test cases. Each test case is described in a single line that contains an integer N representing the size of the board (1 ≤ N ≤ 20). The last line of the input contains a single −1 and should not be processed as a test case.
Output
For each test case output the hexagonal board of the required size, and a line with exactly three asterisks. You have to follow the sample input and output, as well as the example given above. Use only regular spaces, underscores (“_”), slashes (“/”) and backslashes (“\”). There must be no trailing spaces at the end of printed lines, neither empty lines.
Example
Input: 1 3 -1 Output: _ / \ \_/ *** _ _/ \_ _/ \_/ \_ / \_/ \_/ \ \_/ \_/ \_/ / \_/ \_/ \ \_/ \_/ \_/ / \_/ \_/ \ \_/ \_/ \_/ \_/ \_/ \_/ ***
Added by: | Pablo Ariel Heiber |
Date: | 2010-08-19 |
Time limit: | 1.903s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: NODEJS OBJC PERL6 VB.NET |
Resource: | FCEyN UBA ICPC Selection 2008 |
hide comments
2014-09-24 09:34:37 Deepak Gupta
MY wrong and correct submissions, both got AC. |
|
2014-04-21 01:49:05 sarelfeniel
Would make a fun code golf problem. |
|
2012-03-20 05:14:25 Adhityaa
N=2 example's first underscore i wrong... |
|
2010-09-01 00:27:05 anon
invalid F# checker ^_^ |