BUPT2017 springtraining (#1)

Source: Internet
Author: User

https://vjudge.net/contest/162590

A:

It is not difficult to find, when output Lwhen L=r, output 2when L<r.

B :

greedy to match. 1 and n with 2 and n-1 Matching, pairs and pairs directly with A cost of 1 can jump to. So the answer is (n-1)/2

C:

first consider the form in The string deformation of the Aaaab. If there are n a , it is not difficult to see the number of f[n]=2^n-1. Next we scan the original string S from left to right, if we encounter a cnt++, If you encounter b ans+=f[cnt]

D:

Construction Aabbaabb . the string can be.

E :

Ans=max (S[i]). dyed by DFS, for node X, the ice that has been dyed in the set X, regardless of it, is not dyed by the nodes that have not been stained since 1.

because for any sibling node x, y when their father fa was dyed and not dyed in x, y Ice must not affect each other. ( the ice distribution on the tree is continuous, and if there is an interaction between ice, the ice must also belong to fa, then it has been dyed.)

F:

F[n] for Euler functions, so g[n]=n.

so just need to do (k+1)/2 times phi[n] can

Note that if n is even,Phi (n) <=n/2(because even numbers do not match n coprime), if n is odd Phi (n) must be an even number. Therefore , n will change to 1 at the log (n) level .

when just jump out when you n=1

G:

Because there are only two switches per door, the relationship between the two switches is deterministic, either with positive or negative or negative. We use a switch as a node to dye black and white images. There are two kinds of edges, one is the same color and the other is different color. If a contradiction is introduced, it does not exist.

H:

String Simple question

BUPT2017 springtraining (#1)

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.