Codeforces Round #757 Divan and bitwise operations Solution (Java/C++)
Solution: We first consider how to construct an array A that matches the input.…
Solution: We first consider how to construct an array A that matches the input.…
A. Make Even Solution: Obviously, if there is no even number, -1 is output. If the last digit itself is an even number, 0 is output. If the first digit is an even number, 1 is output. Otherwise, output 2.…
Solution: First of all, we can immediately find that for the grid (x, y), no matter how the robot moves, the parity of the grid x+y is always the same. So it is natural to solve for odd and even numbers separately.…
Solution: We assume that a<b, let's observe various possible operations: According to the above picture, we find that when 0<a<b-2a, a will never be replaced,…
A. Mathematical Addition Solution: Obviously, when $x=u^2,\ y=-v^2$, the conditions are met. Code: Java C++…
Solution: First of all, we noticed that for the first pile of stones, it must be operated with the second pile of stones. And when the first pile of stones is taken to empty...…
Solution: We consider the image of querying [x, n]. In other words, as x changes, the changes of the result of query (? x n) .…
A. A.M. Deviation Solution: Obviously it is meaningless to adjust $a_1$ and $a_3$. So it is not difficult to find that the effect of each operation on the result is 3.…