Problem A: pigofzhou的巧克力棒 Description 众所周知,pigofzhou有许多妹子.有一天,pigofzhou得到了一根巧克力棒,他想把这根巧克力棒分给他的妹子们.具体地,这根巧克力棒长为 n,他想将这根巧克力棒折成 n 段长为 1 的巧克力棒,然后分给妹子们. 但是他妹子之一中的 15zhazhahe 有强迫症.若它每次将一根长为 k 的巧克力棒折成两段长为 a 和 b 的巧克力棒,此时若 a=b,则15zhazhahe会得到一点高兴值. pigofzhou想知…
题目链接  2016 BUAA-Final Problem B 考虑一对可行的点$(x, y)$ 根据题意,设$x = ak + 1,y = bk + 1$ 又因为$x$是$y$的祖先的祖先的祖先,所以$y = 8x + d, 0 <= d <= 7$; 那么代入到之前的那个式子    $y = 8x + d$       $= 8(ak + 1) + d = 8ak + d + 8$ 注意到$8ak$对$k$取模后值为$0$,那么如果要满足题意,$d + 8$对$k$取模后值必须为$1$.…
题目描述 Once there was a pig, which was very fond of treasure hunting. One day, when it woke up, it found itself in a strange land of treasure. As for how to come in, or how to go out, no ways to know. Sad. The good news is, it was lucky that it got the…
题目描述 Given an array A with length n  a[1],a[2],...,a[n] where a[i] (1<=i<=n) is positive integer. Count the number of pair (l,r) such that a[l],a[l+1],...,a[r] can be rearranged to form a geometric sequence. Geometric sequence is an array where each…
题目描述 Small koala special love LiaoHan (of course is very handsome boys), one day she saw N (N<1e18) guys standing in a row, because the boys had some strange character,The first time to Liao them will not be successful, but the second time will be su…
题目描述 In country  A, some roads are to be built to connect the cities.However, due to limited funds, only some roads can be built.That is to say,if the limit is 100$, only roads whose cost are no more than 100$ can be built. Now give you n cities, m r…
题目描述 Once there was a pig, which was very fond of treasure hunting. The treasure hunt is risky, and it is inadvertently caught in the peach blossom trap. Fortunately, it has got a map of peach blossom trap. You can think of it as a matrix of R row an…
题目描述 A mod-dot product between two arrays with length n produce a new array with length n. If array A is a1,a2,...,an and array B is b1,b2,...bn, then A mod-dot B produce an array C c1,c2,...,cn such that c1 =  a1*b1%n, c2 = a2*b2%n,...,ci = ai*bi%n,…
题目描述 We define Shuaishuai-Number as a number which is the sum of a prime square(平方), prime cube(立方), and prime fourth power(四次方). The first four Shuaishuai numbers are: How many Shuaishuai numbers in [1,n]? (1<=n<=50 000 000) 输入描述: The input will co…
题目描述 Yuanyuan Long is a dragon like this picture?                                     I don’t know, maybe you can ask him. But I’m sure Yuanyuan Long likes ballons, he has a lot of ballons.           One day, he gets n white ballons and k kinds of pi…