A. The Miracle and the Sleeper
Solution:
Obviously, when b=r/2+1, the value of a%b is the largest. Of course, note that the value of b cannot be less than l.
Code:
Java
C++
B. Scenes From a Memory
Although the conclusion is very simple, it is enough to directly enumerate all the possibilities within three digits by brute force. But the proof of this conclusion is still interesting.
C. Rings
Solution:
First, if the original string is all 1s. It's very simple, just choose any two substrings of length n/2. At this time k=1.
If there is 0 in the original string, then we can let one of t and s contain this 0, and the other does not contain this 0 based on the position of 0.
Code:
Java
C++
D. Two Hundred Twenty One (Easy/Hard)
The main thing to find this conclusion: when the interval length is odd, you only need to delete one to make the sum of interval to 0. After figured out this conclusion, the rest is very simple.