[恢]hdu 2052

2011-12-15 00:13:24

地址:http://acm.hdu.edu.cn/showproblem.php?pid=2052

题意:绘图,绘制n*m的大方框,简单模拟。

mark:PE一次,每组后面有空行。

代码:

# include <stdio.h>
# include <string.h>


# define REP(a,b) for(a = 0 ; a < b ; a++)


char gp[100][100] ;


int main ()
{
int i, n, m ;
while (~scanf ("%d%d", &n, &m))
{
memset(gp, ' ', sizeof(gp)) ;
REP(i,m+2) gp[i][0] = gp[i][n+1] = '|', gp[i][n+2] = '\0' ;
REP(i,n+2) gp[0][i] = gp[m+1][i] = '-' ;
gp[0][0] = gp[0][n+1] = gp[m+1][0] = gp[m+1][n+1] = '+' ;
REP(i,m+2) puts (gp[i]) ;
puts ("") ;
}
return 0 ;
}



原文地址:https://www.cnblogs.com/lzsz1212/p/2314595.html