Codeforces Round #735 ABCD Solutions (Java/C++)
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. 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.…
A. Polycarp and Coins Solution: Divide n by 3. If the remainder is 0, then c1 and c2 are equal; if the remainder is 1, then c1 has one extra; if the remainder is 2, then c2 has one extra.…
A. Find The Array Solution: Just be greedy. Press 1, 3, 5, 7 and so on in sequence, and stop as long as the sum is greater than s. Code: Java C++…
Solution: First, let us pay attention to the range of l and r, $l\leq 1$, $r\geq n$. So, for the first half of a, you can let $a[i]=i+1$, and for the second half of a, you can let $a[i]=i-1$.…
A. AquaMoon and Two Arrays Solution: Just simulate the process. For each time, find the i,j where a[i]>b[i] and a[j]<b[j]. Just apply the operation for this i, j. Code: Java C++…
A. Shortest Path with Obstacle Solution: If and only if the three points of ABF are in a straight line and F is between AB, the answer is Manhattan distance +2.…
A. Exciting Bets Solution: If the two numbers are the same, then obviously the answer is infinity. If the two numbers are different, then let us represent these two numbers to a and a+x.…