HDU2078 review Time "water Problem" "Mathematics"

Source: Internet
Author: User

Review Time

Time limit:1000/1000 MS (java/others) Memory limit:32768/32768 K (java/others) total submission (s): 5093 Accepted S Ubmission (s): 3754
Problem Description
In order to have a good year, XHD began to review, so every night carrying books to the classroom run. XHD Review has a habit, after reviewing a course, he always pick a more simple lesson to review, and he review the efficiency of the course for two courses of the difficulty of the square, and review the efficiency of the first course for 100 and this course of the square of the difficulty difference. XHD This semester chose N course, but one night he can only review M course, ask him to review the maximum efficiency of the night is how much?

Input
The first line of the input data is a data T, which indicates that there is a T group of data.
The first line of data for each group is two integers n (1 <= n <=), m (1 <= m <= N).
Then there are n rows, each with a positive integer a (1 <= a <= 100), indicating the difficulty of the course.

Output
For each set of input data, output an integer that represents the highest efficiency value.

Sample Input
2
2 2
52
25
12 5
89
64
6
43
56
72
92
23
20
22
37
31

Sample Output
5625
8836

Author
Xhd

Source

ACM Program Design Final Exam-warm-up (Thanks XHD & 8600)


The main topic: give you n number, the maximum number of m, the number of m from large to small arrangement, to seek the adjacent square difference (first

The number squared difference is the difference between the number and 100) makes the squared difference and the maximum.

Idea: Actually, it's not that complicated. Take the number of 1~m from the n number. Take only a minimum value (100-min) ^2

You can do it. The problem of the very pit .....

HDU2078 review Time "water Problem" "Mathematics"

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.