The problem is simple, figure out the first line has a few, and the vertical bar width is ok.
Knowing that the vertical bar width and the first line have several characters, the rest is simple.
Here is the AC code:
#include <iostream>using namespace Std;int main () {int n, M;char a;cin >> n;while (n--) {int I, j;cin >> a >> m;int q = (m-2)/2; The first line has a pattern of several characters. int p = (m + 6)/6; Vertical bar width for (i = 0; i < (m-1)/2; i++) {if (i = = 0) {for (j = 0; J < P; j + +) cout << "; for (j = 0; J < Q; j + +) cout << a;cout << Endl;} Else{for (j = 0; J < P; j + +) cout << a;for (j = 0; J < Q; j + +) cout << '; for (j = 0; J < P; j + +) cout < ;< a;cout << Endl;}} for (i = 0; i < (m-1)-(m-1)/2, i++) {if (i = = 0) {for (j = 0; J < P; j + +) cout << '; for (j = 0; j < Q; J + +) cout << a;cout << Endl;} Else{for (j = 0; J < P; j + +) cout << a;for (j = 0; J < Q; j + +) cout << '; for (j = 0; J < P; j + +) cout < ;< a;cout << Endl;}} for (i = 0; i < P; i++) cout << "; for (j = 0; J < Q; j + +) cout << a;cout << endl;if (n! = 0) cout < < Endl;} return 0;}
Hangzhou electric 1256--Painting 8