HDoj 2052 Picture

Posted wzmm

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HDoj 2052 Picture相关的知识,希望对你有一定的参考价值。

Problem Description
Give you the width and height of the rectangle,darw it.
 

 

Input
Input contains a number of test cases.For each case ,there are two numbers n and m (0 < n,m < 75)indicate the width and height of the rectangle.Iuput ends of EOF.
 

 

Output
For each case,you should draw a rectangle with the width and height giving in the input.
after each case, you should a blank line.
 

 

Sample Input
3 2
 

 

Sample Output
+---+ | | | | +---+
 

 

Author
xhd
 

 

Source
 

 

Recommend
linle   |   We have carefully selected several similar problems for you:  2054 2072 2053 2055 2056 
 
 
 
C语言代码如下:
#include<stdio.h>
int main()
{
    int x,y;
    while(scanf("%d%d",&x,&y)!=EOF)
    {
        x+=2;
        y+=2;

        for(int i=0;i<y;i++)
        {
            for(int j=0;j<x;j++)
            {
                if((i==0&&j==0) ||(i==0&&j==x-1)||(i==y-1&&j==0)||(i==y-1&&j==x-1))
                    printf("+");
                else if(i==0||i==y-1)
                    printf("-");
                else if(j==0||j==x-1)
                    printf("|");
                else
                    printf(" ");
            }
            printf("
");
        }
        printf("
");
    }
}

 

以上是关于HDoj 2052 Picture的主要内容,如果未能解决你的问题,请参考以下文章

HDUJ 2052 Picture 模拟

[HDOJ1828]Picture(扫描线,线段树,矩形并周长)

HDOJ1828&&POJ1177Picture(线段树,扫描线)

Access:collating sort order SortOrder[2052]

CK2052-电子商务网站(模块化布局)实战开发

MFC(我用的VS2008)中怎样改变picture控件(picture control)的边框样式???我要通过代码设置的