Codeforces Round #737 ABCD Solutions (Java/C++)
A. Ezzat and Two Subsequences The greedy algorithm for this problem is not difficult to think of. But its rigorous proof still interesting.…
A. Ezzat and Two Subsequences The greedy algorithm for this problem is not difficult to think of. But its rigorous proof still interesting.…
Solution: First, it is not difficult to guess the conclusion of this question: that is, the largest number is divided into one subsequence, and the remaining part is divided into another subsequence. But the proof of this problem is still a bit interesting.…
Solution: This question is divided into four parts. Part 1: Hash Because there at most m segments of the grid that contain digits 1, So we naturally think of hashing…
A. Gregor and Cryptography Solution: If P is an even number, just output 2 and P, so that the remainder is both 0. If P is an odd number, just output 2 and P-1, so that the remainder is both 1.…
A. PizzaForces Solution: It is not difficult to find that each slice takes 2.5 minutes on average. At the same time, we found that all even numbers over 6 can be constructed.…
Solution: First, we notice that the final result is only related to the maximum and minimum values of w. Which mean that as long as w is between the maximum and minimum values,…
A. Cherry Solution: Obviously, we want the max value and min value as large as possible. So that the product can be as large as possible. At least one of…
A. Binary Decimal Solution: Obviously, we only need to check every digit. For each digit, as many as its digit, it needs to be composed of as many numbers. For example, if the tens place of 321 is 2, it needs to be composed of two numbers.…