2014 Anshan network qualifiers 1004 (Greedy) hdu5000

Source: Internet
Author: User
Clone Time Limit: 2000/1000 MS (Java/others) memory limit: 65536/65536 K (Java/Others)
Total submission (s): 291 accepted submission (s): 131


Problem descriptionafter eating food from Chernobyl, DRD got a super power: He cocould clone himself right now! He used this power for several times. he found out that this power was not as perfect as he wanted. for example, some of the cloned objects were tall, while some were short; some of them were fat, and some were thin.

More evidence showed that for two clones A and B, if a was no worse than B in all fields, then B cocould not keep ve. more specifically, DRD used a vector V to represent each of his clones. the vector V has n dimensions, representing a clone having N abilities. for the I-th dimension, V [I] is an integer between 0 and T [I], where 0 is the worst and T [I] is the best. for two clones a and B, whose corresponding vectors were p and q, if for 1 <= I <= N, P [I]> = Q [I], then B cocould not keep ve.

Now, as DRD's friend, ATM wants to know how many clones can have ve at most.
Inputthe first line contains an integer T, denoting the number of the test cases.

For each test case: the first line contains 1 integer N, 1 <=n <= 2000. the second line contains N integers indicating T [1], t [2],..., T [N]. it guarantees that the sum of T [I] in each test case is no more than 2000 and 1 <= T [I].
 
Outputfor each test case, output an integer representing the answer MOD 10 ^ 9 + 7.
Sample Input
21528 6
 
Sample output
17

Question: RT
Idea: Find an X, and then find all solutions that satisfy the sum of X.
X needs to take half of the sum of T [I]. During the game, only the maximum value of X is t [I ~
While finding the number of N (the corresponding position cannot exceed the upper limit of the T array) All solutions that meet the sum of X is a backpack problem, and DP is enough.

2014 Anshan network qualifiers 1004 (Greedy) hdu5000

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.