Write a program that, given pairs of positive natural numbers
height, width, where
width is an even number, generates zig-zags
like the ones shown in the examples.
An arbitrary number of cases, where each consists of two positive
natural numbers height, width, the
width being an even number, in one line.
For each case, the corresponding zig-zag, followed by a blank line.
You can write the output character by character or by previously building strings, as you wish.
Grading up to 10 points:
Slow solution: 5 points.
Fast solution: 10 points.
We understand as a fast solution one which is correct, with linear cost and which passes the public and private tests. We understand as slow solution one which is not fast, but it is correct and passes the public tests.
Input
14 6 8 4 7 2 5 8 4 10 18 4 14 4 7 2 10 4 3 4 11 4 4 10 1 2 13 10 12 6 8 8 3 6 3 4 8 4 10 2 3 2 10 8 14 10 12 10
Output
###*** *###** **###* ***### **###* *###** ###*** *###** **###* ***### **###* *###** ###*** *###** ##** *##* **## *##* ##** *##* **## *##* #* *# #* *# #* *# #* ####**** *####*** **####** ***####* ****#### #####***** *#####**** **#####*** ***#####** ##** *##* **## *##* ##** *##* **## *##* ##** *##* **## *##* ##** *##* **## *##* ##** *##* ##** *##* **## *##* ##** *##* **## *##* ##** *##* **## *##* ##** *##* #* *# #* *# #* *# #* ##** *##* **## *##* ##** *##* **## *##* ##** *##* ##** *##* **## ##** *##* **## *##* ##** *##* **## *##* ##** *##* **## #####***** *#####**** **#####*** ***#####** #* #####***** *#####**** **#####*** ***#####** ****#####* *****##### ****#####* ***#####** **#####*** *#####**** #####***** *#####**** **#####*** ###*** *###** **###* ***### **###* *###** ###*** *###** **###* ***### **###* *###** ####**** *####*** **####** ***####* ****#### ***####* **####** *####*** ###*** *###** **###* ##** *##* **## ##** *##* **## *##* ##** *##* **## *##* #* *# #* *# #* *# #* *# #* *# #* *# #* ####**** *####*** **####** ***####* ****#### ***####* **####** *####*** ####**** *####*** #####***** *#####**** **#####*** ***#####** ****#####* *****##### ****#####* ***#####** **#####*** *#####**** #####***** *#####**** **#####*** ***#####** #####***** *#####**** **#####*** ***#####** ****#####* *****##### ****#####* ***#####** **#####*** *#####**** #####***** *#####****