A. The Miracle and the Sleeper
题解
显然b=r/2+1时,a%b的值最大。当然,要注意b的值不能小于l。
代码
Java
Submission #127456331 - Codeforces
Codeforces. Programming competitions and contests, programming community

C++
Submission #127456424 - Codeforces
Codeforces. Programming competitions and contests, programming community

B. Scenes From a Memory
虽然结论很简单,就是直接依次暴力枚举三位以内的所有可能即可。但是这个结论的证明还是有点意思。
Codeforces Round #741 Scenes From a Memory 题解 (Java/C++)
题解首先,显而易见的,如果原数中出现了1,4,6,8,9这几个数。则其他数都可以被删掉,只留这一位即可。于是我们只剩下2,3,5,7。我们可以很容易的已发现,如果要构造出质数,必然有下列性质:

C. Rings
题解
首先,如果原串全是1。那么很简单,任选两段长度为n/2的子串即可。此时k=1。
如果原串中存在0,那我们就根据0的位置,让t和s一个包含这个0,一个不包含这个0即可。

代码
Java
Submission #127539856 - Codeforces
Codeforces. Programming competitions and contests, programming community

C++
Submission #127539958 - Codeforces
Codeforces. Programming competitions and contests, programming community

D. Two Hundred Twenty One (Easy/Hard)
主要是需要想到一个结论:当区间长度为奇数时,只需要删除一个就可以让区间和为0。想通了这个结论,后面就很简单了。
Codeforces Round #741 Two Hundred Twenty One 题解 (Java/C++)
题解首先,我们令$b[i]=a[i]\cdot (-1)^{(i-1)}$,$sum(l,r)=\sum_{i=l}^r{b[i]}$。于是对于任意的i,b[i]要么是1要么是-1。因此如果最后的和为0,那么必然有1的数目和-1的数目相同。于是必然有,如果要和为0,那么这个区间的长度必为偶数。
