Codeforces Round #729 ABCD Solutions (Java/C++)
A. Odd Set
Solution:
Just need count the number of even numbers. If and only if the number of even numbers and the number of odd numbers are the same, then we output "Yes"
Code:
Java
C++
B. Plus and Multiply
Solution:
It is not difficult to find that if n is in the set, then n must be expressed as $a^x+y\cdot b$, where $x\geq 0, y \geq 0$. So, it just needs enumerate the x.
For example, $(a+b)\cdot a + b$, it is equivalent to $a^2+b\cdot(a+1)$.
Code:
Java
C++
C. Strange Function
The key to this question is that: As the value of f(i) increases, the remaining i cannot be divisible by any existing number, and therefore cannot be divisible by the least common multiple of all existing numbers.
D. Priority Queue
The main key of this question is to transform the question into how many seed sequences each number can appear in. And pay attention to some details in the calculation process.