Hangzhou Electric 1256--Painting 8

Source: Internet
Author: User

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 &lt ;< 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 &lt ;< 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.