Problem H
Save Hridoy
Input: Standard Input
Output: Standard Output
It would have been great if all the banners with good words could
inspire us all. Then we could only make large banners with good words on them
to make this world beautiful. With all the good wishes of our heart, we will
make such a banner today -- a banner to save a life1 , a banner to
save humanity.
In this problem the program generated banners will contain the text
“SAVE HRIDOY”. We will make this banner with different text size and two
possible types of orientations: horizontal and vertical. As we will make
banners of different size in plain monochrome text, we will use two different
ASCII characters to denote black and white pixels. In this process the smallest
possible banner (font size 1) for us in horizontal orientation is:
*****..***..*...*.*****...*...*.*****.*****.***...*****.*...*
*.....*...*.*...*.*.......*...*.*...*...*...*..*..*...*..*.*.
*****.*****.*...*.***.....*****.*****...*...*...*.*...*...*..
....*.*...*..*.*..*.......*...*.*.*.....*...*..*..*...*...*..
*****.*...*...*...*****...*...*.*..**.*****.***...*****...*..
You can see
that here black pixels are formed with the ‘*’ character and white pixels are marked
with the ‘.’ character.
In this banner, each character is represented in a (5 x 5) grid, two
consecutive characters in a single word are separated by single vertical dotted
line and the two words are separated by three vertical dotted lines. In case of
vertical banners (of font size 1) two consecutive letters in a single word are
separated by a horizontal dotted line and two words are separated three
horizontal dotted lines. Look at the second output for sample input to know how
vertical banners are formed. In case of a banner of font size 2, each
pixel is represented by (2*2) grid of pixels. So actually a banner of
font size two has double the width and double the height of a banner of font
size 1.
Input
The input file contains at most 30 lines of inputs. Each line contains an integer N (0<N<51). This value of N denotes the font size and orientation of
a banner.
Input is terminated by a line containing a single zero.
This line should not be processed.
Output
If N is positive then you
have to draw a banner of horizontal orientation and if N is negative
then you have to draw a banner of vertical orientation. The detailed
description of output for these two types of cases is given below:
If N is positive then
produce 5N lines of output. These lines actually draw the horizontal
banner. Two consecutive letters in a word are separated by N vertical
dotted lines. Two words are separated by 3N vertical dotted lines.
If N is negative then
produce 5L*10+ 11L lines of output, where L is the absolute value
of N. Two consecutive characters in a word are separated by L
horizontal dotted lines, and two words are separated by 3L horizontal
dotted lines.
After the output of each test
case print two blank lines.
Sample
Input
Output
for Sample Input
***** *.... ***** ....* ***** ..... .***. *...* ***** *...* *...* ..... *...* *...* *...* .*.*. ..*.. ..... ***** *.... ***.. *.... ***** ..... ..... ..... *...* *...* ***** *...* *...* ..... ***** *...* ***** *.*.. *..** ..... ***** ..*.. ..*.. ..*.. ***** ..... ***.. *..*. *...* *..*. ***.. ..... ***** *...* *...* *...* ***** ..... *...* .*.*. ..*.. ..*.. ..*.. **********....******....**......**..**********......**......**..**********..**********..******......**********..**......** **********....******....**......**..**********......**......**..**********..**********..******......**********..**......** **..........**......**..**......**..**..............**......**..**......**......**......**....**....**......**....**..**.. **..........**......**..**......**..**..............**......**..**......**......**......**....**....**......**....**..**.. **********..**********..**......**..******..........**********..**********......**......**......**..**......**......**.... **********..**********..**......**..******..........**********..**********......**......**......**..**......**......**.... ........**..**......**....**..**....**..............**......**..**..**..........**......**....**....**......**......**.... ........**..**......**....**..**....**..............**......**..**..**..........**......**....**....**......**......**.... **********..**......**......**......**********......**......**..**....****..**********..******......**********......**.... **********..**......**......**......**********......**......**..**....****..**********..******......**********......**.... |
1 Hridoy,
who is a student of the Computer Science and Engineering Department of
Bangladesh UET, is suffering from Leukemia. His friends, relatives and well-wishers
have are collecting the fund required to bear his treatment expenses and he is
now in Singapore for treatment. So now let us make this (“SAVE HRIDOY”) big
banner in our heart and pray.
2 The font
size of output is kept small to make it fit into page.
Problem
setter: Shahriar Manzoor
Special
Thanks: Monirul Hasan
#include <stdio.h>
char neg[][10] = {
"*****","*....","*****","....*",
"*****",".....",".***.","*...*",
"*****","*...*","*...*",".....",
"*...*","*...*","*...*",".*.*.",
"..*..",".....","*****","*....",
"***..","*....","*****",".....",
".....",".....","*...*","*...*",
"*****","*...*","*...*",".....",
"*****","*...*","*****","*.*..",
"*..**",".....","*****","..*..",
"..*..","..*..","*****",".....",
"***..","*..*.","*...*","*..*.",
"***..",".....","*****","*...*",
"*...*","*...*","*****",".....",
"*...*",".*.*.","..*..","..*..",
"..*.."};
char pos[6][200] = {
"*****..***..*...*.*****...*...*.*****.*****.***...*****.*...*",
"*.....*...*.*...*.*.......*...*.*...*...*...*..*..*...*..*.*.",
"*****.*****.*...*.***.....*****.*****...*...*...*.*...*...*..",
"....*.*...*..*.*..*.......*...*.*.*.....*...*..*..*...*...*..",
"*****.*...*...*...*****...*...*.*..**.*****.***...*****...*.."
};
int main() {
int n, i, j, k, l;
while(scanf("%d", &n) == 1 && n) {
if(n < 0) {
n = -n;
for(i = 0; i < 61; i++) {
for(j = 0; j < n; j++, puts("")) {
for(l = 0; neg[i][l]; l++)
for(k = 0; k < n; k++)
putchar(neg[i][l]);
}
}
} else {
for(i = 0; i < 5; i++) {
for(j = 0; j < n; j++, puts("")) {
for(l = 0; pos[i][l]; l++)
for(k = 0; k < n; k++)
putchar(pos[i][l]);
}
}
}
puts("\n");
}
return 0;
}