UVA 10894 - Save Hridoy

题目来源:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1835

模拟!

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>

using namespace std;

char Graph1[5][70] = {
    "*****..***..*...*.*****...*...*.*****.*****.***...*****.*...*",
    "*.....*...*.*...*.*.......*...*.*...*...*...*..*..*...*..*.*.",
    "*****.*****.*...*.***.....*****.*****...*...*...*.*...*...*..",
    "....*.*...*..*.*..*.......*...*.*.*.....*...*..*..*...*...*..",
    "*****.*...*...*...*****...*...*.*..**.*****.***...*****...*.."
};
char Graph2[61][6] = {
    "*****", "*....", "*****", "....*", "*****", ".....", ".***.", "*...*", "*****", "*...*", "*...*", ".....", "*...*",
    "*...*", "*...*", ".*.*.", "..*..", ".....", "*****", "*....", "***..", "*....", "*****", ".....", ".....", ".....",
    "*...*", "*...*", "*****", "*...*", "*...*", ".....", "*****", "*...*", "*****", "*.*..", "*..**", ".....", "*****",
    "..*..", "..*..", "..*..", "*****", ".....", "***..", "*..*.", "*...*", "*..*.", "***..", ".....", "*****", "*...*",
    "*...*", "*...*", "*****", ".....", "*...*", ".*.*.", "..*..", "..*..", "..*..",
};

int main()
{
    bool flag;
    int tmp, n, cnt, i, j;
    while(scanf("%d", &n))
    {
        if(n == 0)
            break;
        flag = false;
        if(n < 0)
        {
            flag = true;
            n = -n;
        }
        if(!flag)//为整数
        {
            for(i = 0; i < 5; ++i)
            {
                tmp = 0;
                while(tmp < n)//每一行重复n次
                {

                    for(j = 0; Graph1[i][j]; ++j)//每个点重复n次
                    {
                        cnt = 0;
                        while(cnt < n)
                        {
                            printf("%c", Graph1[i][j]);
                            cnt++;
                        }
                    }
                    tmp++;
                    printf("\n");
                }
            }
        }
        else//为负数
        {
            for(i = 0; i < 61; ++i)
            {
                tmp = 0;
                while(tmp < n)
                {
                    for(j = 0; Graph2[i][j]; ++j)
                    {
                        cnt = 0;
                        while(cnt < n)
                        {
                            printf("%c", Graph2[i][j]);
                            cnt++;
                        }
                    }
                    ++tmp;
                    printf("\n");
                }
            }
        }
        printf("\n\n");
    }
    return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值