Test Address: Sushi Dinner
procedure: The subject needs to use the pressure dp+ number theory.
Considering n n n Small, we find that the problem condition is equivalent to the set of mass factors of the number chosen by two persons. So we let F (i,j,k) F (i, J, K) F (i,j,k) take into account the number of former I I I, where the first person takes the number of the mass factor set for J J J, the second The number of people taken by the mass factor set of K K of the scheme number, the state transfer equation should be well written, see the code, the technique of enumerating subsets can be done O (n3p (n)) O (n 3 p (n)) O (N3^{p (n)}), where P (n) p (n) p (n) is n n The number of the mass within. The answer is ∑j∩k=∅f (n,j,k) ∑j∩k =∅f (N, J, K) \sum_{j\cap k=\varnothing}f (n,j,k).
But when n n is bigger, obviously the above method will time out, how to do it. We found that each number contains at most one >n−−√> n >\sqrt N of the mass factor, which is very good, and we can consider the contribution of this mass factor to the answer when it is a certain number x x x. So we compress the ≤n−−√≤n \le \sqrt N, and then take the number without >n−−√> n >\sqrt N-Mass factor out of the above method, and then the enumeration is larger than the N−−√n