NOIP2016 Raising the group preliminary (C + + language) question personal random analysis Part 2.

Source: Internet
Author: User

Log Camp Day1 simulation game in situ explosion, mentality collapsed. So I intend to write a preliminary question to relax.

The last random analysis to the choice question, this time I want to talk about the following questions.

Problem solving

T1. There is a 1x8 grid pattern, black and white two-color fill each square, two black lattice can not be adjacent to the number of solutions.

I'm sure if no one in the exam room told me it was a Fibonacci sequence, I couldn't remember.

At that time, my practice was to consider how many black lattice, for example, fill 0 black lattice, there are 1 ways, fill 1 black lattice, 8 methods, fill 2 black lattice, 3 black lattice, 4 black lattice.

Because there are only 8 squares, and the black lattice can not be adjacent, so Haig can not fill more than 4 blocks, the truth is obvious.

At that time I could be Shi or count, anyway the last number is not 55.

That's what the positive solution says.

We consider only one lattice case, there are only two kinds of filling scheme, can remember f (1) = 2;

Then consider only two lattice cases, only three kinds of filling scheme, can remember F (2) = 3;

(Eh, these two scenarios should have a nothing to fill in the situation, ah, this is not a repetition AH)

No.

Then consider only the case of three lattices, which can be one or the other, fill one in the left, fill one in, fill one in the right, fill two on both sides, there are 5 cases, we suspense f (3) = 5.

Can you find the relationship between F (3) and F (1) and F (2)?

Let's look back at f (1) and F (2), F (1) for the fill, or not, F (2) to fill in the first, fill in the second, or not.

Have you found that some of the cases in F (3) are exactly f (1) or F (2)?

That's right. This is a variant of the recursive Fibonacci, since there is always f (n) = f (n-1) + f (n-2) (f (1) = 1,f (2) = 2), then f (8).

T2. Schedule the time. How do you say this question? I can't say. The answer is 3, if you want to ask me why is 3, I can only say the truth is this ... This one.. It is difficult to speak in a very popular way, ah anyway is just a few try to find a few arrangements. is to find the same paragraph can be in the examination of the subject, judge whether two subjects can test together is to see if a person is not at the same time reported the two subjects, if it is also reported that the two subjects must be placed in a different time period test.

Read the problem.

T1. Congratulations on your discovery of the NOIP2016 Classic card comma problem!

(although I didn't get stuck 23333)

Look at the main function to know that the function of this algorithm is to store a array upside down, except for the comma, the rest is to send sub-parts.

T2. Congratulations, you found the noip2016 the classic card comma problem!

(What the hell is this, how can I simulate it so long?)

We can generally see that the problem is related to the evil string. To tell you the truth, I'm guessing the output based on the input data.

Perhaps there is something in the sense, I found that the input data has such a small feature.

The strings are separated by a colon, the string on the left is shorter and the string on the right is longer, but you should be able to find the relationship between the left and right strings. Even if you do not see the first two of SARS can also be a hint of the obvious ...

Yes, that's what you think, the judgment is not "abbreviation" ...

T3. Need to rely on the brain loop recursion. It? Not.. If you know what LPs mean.

Let yourself simulate it. Note that the intermediate results can be found to determine the length of the longest palindrome substring ...

The longest palindrome substring of the English abbreviation is LPs, so there are many people direct seconds dropped this problem ...

T4. The Taste of graph theory (although the input data is a tree)

This is really nothing to say. Give you a tree, let you remove a node and the adjacent edge, so that the remaining tree inside the largest connected block contains the fewest nodes, allowing you to output the deleted node number and the maximum number of nodes contained in the Unicom block.

Know the meaning even if you do not look at the code hand can be too. So there's really nothing to say ...

NOIP2016 Raising the group preliminary (C + + language) question personal random analysis Part 2.

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.