杭电 2052 Picture

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

开始时把行列坐标搞错了

#include<stdio.h>
int main(){
	int n,m,i,j;
	char s[75][75];
	while(scanf("%d%d",&n,&m) != EOF){
		for(i = 0;i <= m+1;i++)
		for(j = 0;j <= n+1;j++){
			s[i][j] = ' ';
		}		
		s[0][0] = s[0][n+1] = s[m+1][0] = s[m+1][n+1] = '+';
		for(i = 1;i <= n;i++){
			s[0][i] = s[m+1][i] = '-';			
		}
		for(i = 1;i <= m;i++){
			s[i][0] = s[i][n+1] = '|';
		}
		for(i = 0;i <= m+1;i++){
			for(j = 0;j <= n+1;j++){
				printf("%c",s[i][j]);
			}	
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}


猜你喜欢

转载自blog.csdn.net/u012102588/article/details/18922687