The max number = max(max number, answer).
The main mission of this problem is to count each players number of right questions.
Seeing the operation, we can easily think of Euclidean algorithm which is the way to calculate GCD.
The biggest answer is that after the operation the number can remain it self.
If you have three numbers 1, 2, 3 and want the length of the consecutive subsequence be two, the answer is 3-2+1, because you can choose 1, 2 or 1, 3.
Because of selecting the same character is allowed, so the probability of one character is
There is a fuzzy point in the description. That is all the car has to wait the same amount of time. For example,
This is a rounding problem. Since it has only three number after the point, you just need to find the last number n and if it's more than four...
This problem is gcd or lcm problem.
The core of the problem is Dichotomy which is Binary search the best range of the X.
For me, the core of the problem is to figure out how the matches carry on exactly. It's the hardest part for me.
Position of the house can be divided into two situation, Uphill slope and Downhill slope. And the two situations are used to calculate the Y position of the house.