Question 1:
Give m numbers less than N and find the number of occurrences greater than M Div 2. 1 <= n <= 2 ^ 31 1 <= m <= 10000
Problem solving process:
1. We can see that the data range of M is relatively small. We can sort the orders directly by counting the number of occurrences of each number.
Question 2:
The score a/B (0 <= A <B <= 1000) is given, and it must be split into the sum of the scores of 1 as few molecules as possible, the maximum denominator of the same length must be as small as possible.
Problem solving process:
1. This is an example of ID-DFS on the black book, apply directly, because there is no way to determine the depth of the search, so you must set a boundary. For the processing of scores, you can directly use the total score + the approximate score. It is not feasible to use double to divide the data directly.
2. Several branches:
Pruning a: first, determine the order, that is, search by denominator from small to large, not from large to small .. Because you cannot determine the maximum value.
Pruning B: Do not enumerate the last score. The remaining value to be split is the last score. Therefore, you only need to check whether its denominator is larger than the previous denominator pre, and whether the molecule is 1.
Pruning C: when enumerating the current denominator X, there will be an upper and lower bounds. The first step is bigger than the previous denominator pre (x> pre ), secondly, this score cannot be greater than the remaining value (A/B), that is, 1/x <a/B --> x> B/
Finally, if the DEP score can be split, the score must be greater than the remaining one, so DEP/x> A/B --> x <(B * dep)/;
3. when I write for the first time, I feel that the largest denominator is as small as possible, so as long as the first denominator is larger, so after the denominator is enumerated, I will exit after finding the first answer, but this is wrong. It is required that the numerator of each score be 1. Although the first denominator is relatively large, the numerator of the last score may not be 1.
Question 3:
Question:
1 model (3) day1