2014 Blue Bridge cup preliminaries C/C ++ undergraduate Team B problem solving report print graphics

Source: Internet
Author: User

Title: Print Image
James found shapes and texts in the castle of Planet X:
Rank = 3
*
**
**
****


Rank = 5
*
**
**
****
**
****
****
********
**
****
****
********
****
********
********
****************


Ran = 6
*
**
**
****
**
****
****
********
**
****
****
********
****
********
********
****************
**
****
****
********
****
********
********
****************
****
********
********
****************
********
****************
****************
********************************



James made his brains and wrote the following program to print the image.


# Define N 70


Void f (char a [] [N], int rank, int row, int col)
{
If (rank = 1 ){
A [row] [col] = '*';
Return;
}

Int w = 1;
Int I;
For (I = 0; I <rank-1; I ++) w * = 2;

____________________________________________;
F (a, rank-1, row + w/2, col );
F (a, rank-1, row + w/2, col + w );
}


Int main ()
{
Char a [N] [N];
Int I, j;
For (I = 0; I <N; I ++)
For (j = 0; j <N; j ++) a [I] [j] = '';

F (a, 6, 0, 0 );

For (I = 0; I <N; I ++ ){
For (j = 0; j <N; j ++) printf ("% c", a [I] [j]);
Printf ("\ n ");
}

Return 0;
}


Analyze the program logic carefully and enter the missing code section.

Submit answers in a browser. Do not fill in the existing code in the question. Do not write any additional content (such as descriptive text)


Answer: f (a, rank-1, row, col + w/2)


Relatively simple recursion

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.