[HDU] [2052] Picture

Problem Description

Loading...

Problem Analysis

Quite an interesting problem
Doing this kind of problem just feels pleasant
Although once you’re familiar with loops
it does nothing for improving your skills…

cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#include<stdio.h>
int main() {
	int i,j,n,m;
	while(scanf("%d %d",&n,&m)!=EOF) {
		printf("+");
		for(i=0; i<n; i++)
			printf("-");
		printf("+\n");
		for(j=0; j<m; j++) {
			printf("|");
			for(i=0; i<n; i++)
				printf(" ");
			printf("|\n");
		}
		printf("+");
		for(i=0; i<n; i++)
			printf("-");
		printf("+\n\n");
	}
	return 0;
}

Loading...