codeforces #327 A. Flipping Game

http://codeforces.com/contest/327/problem/A

codeforces 456 C. Boredom

http://codeforces.com/contest/456/problem/C

codeforces #336 div 2 B. Hamming Distance Sum

http://codeforces.com/contest/608/problem/B

codeforces #336 div 2 A. Saitama Destroys Hotel

http://codeforces.com/contest/608/problem/A

codeforces #332 div 2 D. Spongebob and Squares

http://codeforces.com/contest/599/problem/D

codeforces #333 div 2 D. Lipshitz Sequence

http://codeforces.com/contest/602/problem/D

In order to prove it properly, we’ll consider three numbers Ai, Aj, Ak (i < j < k) and show that one of the numbers L1(i, j),L1(j, k) is  ≥ L1(i, k). W.l.o.g., we may assume Ai ≤ Ak. There are 3 cases depending on the position of Aj relative to Ai, Ak:

• Aj > Ai, Ak — we can see that L1(i, j) > L1(i, k), since |Aj - Ai| = Aj - Ai > Ak - Ai = |Ak - Ai| and j - i < k - i; we just need to divide those inequalities
• Aj < Ai, Ak — this is similar to the previous case, we can prove that L1(j, k) > L1(i, k) in the same way
• Ai ≤ Aj ≤ Ak — this case requires more work:
• we’ll denote d1y = Aj - Ai, d2y = Ak - Aj, d1x = j - i, d2x = k - j
• then, L1(i, j) = d1y / d1x, L1(j, k) = d2y / d2x, L1(i, k) = (d1y + d2y) / (d1x + d2x)
• let’s prove it by contradiction: assume that L1(i, j), L1(j, k) < L1(i, k)
• d1y + d2y = L1(i, j)d1x + L1(j, k)d2x < L1(i, k)d1x + L1(i, k)d2x = L1(i, k)(d1x + d2x) = d1y + d2y, which is a contradiction

We’ve just proved that to any L1 computed for two elements A[i], A[k] with k > i + 1, we can replace one of i, j by a point jbetween them without decreasing L1; a sufficient amount of such operations will give us k = i + 1. Therefore, the max. L1can be found by only considering differences between adjacent points.

codeforces #333 div 2 C. The Two Routes

http://codeforces.com/problemset/problem/602/C

codeforces #333 div 2B. Approximating a Constant Range

http://codeforces.com/contest/602/problem/B

codeforces #334 div 2 E. Lieges of Legendre

http://codeforces.com/contest/604/problem/E

http://m.blog.csdn.net/blog/qq_24451605/50154973

codeforces #334 div 2 D.Moodular Arithmetic

http://codeforces.com/contest/604/problem/D

f(0)=0,对于其他的值，当f（x）确定时，f（k*x%p）也随之确定，那么把k*x%p看做新的x,f（k*k*x%p）也随之确定…相当于【1，p-1】被分为r个小环，确定每个环可以任选一个数字，ans=p^r。环的个数可以用dfs跑一遍得到r.

hdu 1221 Rectangle and Circle

http://acm.hdu.edu.cn/showproblem.php?pid=1221

poj 3687 Labeling Balls

http://poj.org/problem?id=3687

poj 3660 Cow Contest (floyd,传递闭包)

http://poj.org/problem?id=3660

hdu 2647 rewards

http://acm.hdu.edu.cn/showproblem.php?pid=2647

a b
a c
c b

hdu 3342 Legal or Not

http://acm.hdu.edu.cn/showproblem.php?pid=3342