24h購物| | PChome| 登入
2013-02-15 21:09:49| 人氣315| 回應0 | 上一篇 | 下一篇

[UVA] 10894 - Save Hridoy

推薦 0 收藏 0 轉貼0 訂閱站台

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                            

-1
2
0

 

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;
}

台長: Morris
人氣(315) | 回應(0)| 推薦 (0)| 收藏 (0)| 轉寄
全站分類: 不分類 | 個人分類: UVA |
此分類下一篇:[UVA] 10500 - Robot maps
此分類上一篇:[UVA][SSSP] 10947 - Bear with me, again..

是 (若未登入"個人新聞台帳號"則看不到回覆唷!)
* 請輸入識別碼:
請輸入圖片中算式的結果(可能為0) 
(有*為必填)
TOP
詳全文