【ZhengQing】[1224]Draw a Table

Problem Description

Loading...

Problem Analysis

I already said I totally can’t handle these cute little problems~
Hahaha…
Still, the logic in this one is harder than the previous drawing problems~

cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include<stdio.h>
#include<string.h>
void heng(int m) {
	int j;
	printf("+");
	for(j=0; j<m; j++)
		printf("--+");
	printf("\n");
}
void shu(int m) {
	int i=2,j;
	while(i--) {
		printf("|");
		for(j=0; j<m; j++)
			printf("  |");
		printf("\n");
	}
}
int main() {
	int T,m,n;
	int i,j;
	scanf("%d",&T);
	while(T--) {
		scanf("%d %d",&n,&m);
		heng(m);
		for(i=0; i<n; i++) {
			shu(m);
			heng(m);
		}
	}
	return 0;
}

Problem link: ZZULI [1224] Draw a Table

Loading...