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)