Codeforces Round #738 ABCD Solutions (Java/C++)
A. Mocha and Math Solution: Because $a\&b\leq a$. So, the answer is $a_1\&a_2\&a_3\&...\&a_n$. Code: Java C++…
A. Mocha and Math Solution: Because $a\&b\leq a$. So, the answer is $a_1\&a_2\&a_3\&...\&a_n$. Code: Java C++…
Solution: First, it is obvious that we will use "Disjoint-set data structure" to determine whether two points are in the same tree.…
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,…