关闭

【杭电-oj】-2052-Picture

113人阅读 评论(0) 收藏 举报
分类:

Picture

Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 24508    Accepted Submission(s): 12457


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
+---+ | | | | +---+
 

注意看题!!!输出一组有一行空格!!!wa了那么多次,忧伤!

#include<cstdio>
int main()
{
	int m,n;
	while(~scanf("%d%d",&m,&n))
	{
		printf("+");
		for(int i=1;i<=m;i++)
			printf("-");
		printf("+\n");
		for(int i=1;i<=n;i++)
		{
			printf("|");
			for(int j=1;j<=m;j++)
				printf(" ");
			printf("|\n");
		}
			printf("+");
		for(int i=1;i<=m;i++)
			printf("-");
		printf("+\n");
		printf("\n");
	}
	return 0;
 } 



0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:55788次
    • 积分:3931
    • 等级:
    • 排名:第8025名
    • 原创:351篇
    • 转载:1篇
    • 译文:0篇
    • 评论:14条