hdu杭电2052为什么老是WRONG ANSWER, 还有数组用完之后第二次还用,怎么初始化?
#include<stdio.h>int main()
{
int m,n,i,j;
char a[75][75]={""};
while(scanf("%d%d",&m,&n)!=EOF)
{
for(i=0;i<n+2;i++)
{
for(j=0;j<m+2;j++)
{
a[i][0]=a[i][m+1]='+';
}
}
for(i=1;i<=m;i++)
{
a[0][i]='-';
}
for(i=1;i<=m;i++)
{
a[n+1][i]='-';
}
for(i=1;i<n+1;i++)
{
a[i][0]=a[i][m+1]='|';
}
for(i=0;i<n+2;i++)
{
for(j=0;j<m+2;j++)
{
printf("%c",a[i][j]);
}
printf("\n");
}
for(i=0;i<75;i++)
{
for(j=0;j<75;j++)
{
a[i][j]=' ';
}
}
printf("\n");
}
return 0;
}
题目:
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
+---+
| |
| |
+---+
[ 本帖最后由 bianchenyang 于 2011-11-15 09:26 编辑 ]