UVA10894 Save Hridoy【Ad Hoc】

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 × 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.

Footnotes:

  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 for the second sample is kept small to make it fit into page.

Sample Input

-1
2
0

Sample Output

*****
*....
*****
....*
*****
.....
.***.
*...*
*****
*...*
*...*
.....
*...*
*...*
*...*
.*.*.
..*..
.....
*****
*....
***..
*....
*****
.....
.....
.....
*...*
*...*
*****
*...*
*...*
.....
*****
*...*
*****
*.*..
*..**
.....
*****
..*..
..*..
..*..
*****
.....
***..
*..*.
*...*
*..*.
***..
.....
*****
*...*
*...*
*...*
*****
.....
*...*
.*.*.
..*..
..*..
..*..
**********....******....**......**..**********......**......**..**********..**********..******......**********..**......**
**********....******....**......**..**********......**......**..**********..**********..******......**********..**......**
**..........**......**..**......**..**..............**......**..**......**......**......**....**....**......**....**..**..
**..........**......**..**......**..**..............**......**..**......**......**......**....**....**......**....**..**..
**********..**********..**......**..******..........**********..**********......**......**......**..**......**......**....
**********..**********..**......**..******..........**********..**********......**......**......**..**......**......**....
........**..**......**....**..**....**..............**......**..**..**..........**......**....**....**......**......**....
........**..**......**....**..**....**..............**......**..**..**..........**......**....**....**......**......**....
**********..**......**......**......**********......**......**..**....****..**********..******......**********......**....
**********..**......**......**......**********......**......**..**....****..**********..******......**********......**....

 

问题链接UVA10894 Save Hridoy

问题描述:(略)

问题分析:简单题,不解释。

程序说明:(略)

参考链接:(略)

题记:(略)

 

AC的C++语言程序如下:

/* UVA10894 Save Hridoy */

#include <bits/stdc++.h>

using namespace std;

const int N = 5;
const int M = 61;

const char g[N][70] = {
    "*****..***..*...*.*****...*...*.*****.*****.***...*****.*...*",
    "*.....*...*.*...*.*.......*...*.*...*...*...*..*..*...*..*.*.",
    "*****.*****.*...*.***.....*****.*****...*...*...*.*...*...*..",
    "....*.*...*..*.*..*.......*...*.*.*.....*...*..*..*...*...*..",
    "*****.*...*...*...*****...*...*.*..**.*****.***...*****...*.."
};

const char g2[M][6] = {
    "*****", "*....", "*****", "....*", "*****", ".....", ".***.", "*...*", "*****", "*...*", "*...*", ".....", "*...*",
    "*...*", "*...*", ".*.*.", "..*..", ".....", "*****", "*....", "***..", "*....", "*****", ".....", ".....", ".....",
    "*...*", "*...*", "*****", "*...*", "*...*", ".....", "*****", "*...*", "*****", "*.*..", "*..**", ".....", "*****",
    "..*..", "..*..", "..*..", "*****", ".....", "***..", "*..*.", "*...*", "*..*.", "***..", ".....", "*****", "*...*",
    "*...*", "*...*", "*****", ".....", "*...*", ".*.*.", "..*..", "..*..", "..*..",
};

int main()
{
    int n;
    while(cin >> n && n) {
        if(n > 0) {
            for(int i = 0; i < N; i++) {
                int t = 0;
                while(t++ < n) {
                    for(int j = 0; g[i][j]; j++) {
                        int cnt = 0;
                        while(cnt++ < n)
                            cout << g[i][j];
                    }
                    cout << endl;
                }
            }
        } if(n < 0) {
            n = -n;
            for(int i = 0; i < M; i++) {
                int t = 0;
                while(t++ < n) {
                    for(int j = 0; g2[i][j]; j++) {
                        int cnt = 0;
                        while(cnt++ < n)
                            cout << g2[i][j];
                    }
                    cout << endl;
                }
            }
        }
        cout << endl << endl;
    }

    return 0;
}

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值