A. Long Comparison
Solution:
First, we can compare the digits of x. If the digits are different, we will continue to multiply the number with less digits by 10 until the digits are the same.
Then compare the adjusted p. If p is the same, then compare x.
Code:
Java
C++
B. Absent Remainder
Solution:
Obviously x mod y <x. Therefore, we always choose x as the minimum value of the array, and then y can be chosen from the remaining numbers.
Code:
Java
C++
C. Poisoned Dagger
Solution:
Binary search for the value of k. Calculate the total damage according to the problem description each time.
Code:
Java
C++
D. MEX Sequences
This problem needs to think clearly about the ways of constructing it. With the construction method the DP will be more obvious.
E. Crazy Robot
Solution:
Starting from L, just DFS. Look for the cell that is a + each time, and then continue to search based on the + cell.
On the problem, C++ is easier to TLE than Java. Because the values of n and m vary widely, the speed of C++ dynamically generating and initializing a two-dimensional array seems not as fast as Java.
Code:
Java
C++