Blog·Tanky WooABOUTRSS

HDOJ 1256 画8

17 Aug 2010
这篇博客是从旧博客 WordPress 迁移过来,内容可能存在转换异常。

题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=1256


模拟题做的人都想吐了,太没技术含量~~~ 直接COPY别人的了。

#include
using namespace std;

int main()
{
    int N;
    char ch;
    int T;
    cin >> T;
    while(T -- )
    {
        cin >> ch >> N;
        int wid = N / 6 + 1;
        int up_high = (N - 3)/ 2;
        int down_high = N - 3 - up_high;
        int i, j;
        for( j = 1; j <= N; j ++)
        {
            for( i = 1; i <= (2*wid + down_high); i ++)
            {
                if(j == 1 || j == N || j ==(N - 1 - down_high))
                {
                    if(i <= wid)
                        cout <<" ";
                    else if( i > wid && i <= wid + down_high)
                        cout << ch;
                }
                else
                {
                    if( i <= wid || i >wid + down_high)
                        cout << ch;
                    else
                        cout << " ";
                }
            }
            cout << endl;
        }
        if( T != 0)
        cout << endl;

    }
    return 0;
}