The Crazy Fibonacci
After learning something strange and then out of the question
The outermost mode p is obvious, but the inner layer does not have the modulus p
So, what's the model, apparently the cyclic section of the Fibonacci
Then we can get a layer of Fibonacci loops on each layer.
Then it can be calculated from the inward external use matrix multiplication.
For the minimum cycle section of Fibonacci, see the section on this blog's fib-seeking cycle.
Of course, this problem can only ask for a circular section, do not seek the minimum cycle section, it will be good to write more
(But I'm not going to tell you that the end will explode long long)
Crazy painter.
We set up a total of K unicom points in the tree.
There is an F (i) set of the link points containing point I
So the answer is obviously Sigma (f (i)/k)
First, we think about how to ask for K, for the set of interconnected points on any tree
There must be only one point with the smallest depth
Set g (i) to indicate that I is the minimum number of points in the depth of the Unicom block
If J is a child of I, then G (i) is obviously a product of G (j) +1
So K=sigma (g (i))
After that we consider F (i), the set of the Unicom points where any one of the points
There are only two cases of this point:
1, is the smallest point of depth
2, not the smallest point in depth
If 2 is present, his father must be in this unicom block
The father of I is J.
We can get F (i) =g (i) + g (i) * (f (j)/(g (i) +1))
Then the statistical answer can be
Cojs crazy painter Crazy Fibonacci report