Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

( Method 1 ) Let's first implement Professor Kim's method properly: Take the scores of n students as input, sort them in descending order, and

(Method 1) Let's first implement Professor Kim's method
properly:
Take the scores of n students as input, sort them in descending order,
and then divide them into k groups.
Assume that the lower group numbers correspond to higher scores.
Starting from i =1 up to k-1, calculate the differences between the
minimum score of the i
th group and the maximum score of the (i+1)th
group, and maximize the sum of these differences.
However, each group must have at least one student
Take input from standard input.
The first line contains n and k.
The next line contains the scores of n students in ascending order of
enrollment numbers.
Here, n is a number greater than or equal to k.
Each score can range from 0 to 1,000, and ties are possible.
Surprisingly, n can be as large as 104.
k is a positive integer less than or equal to 12.(Note: depending on the
school, each grade (A, B, C, D) may be divided into 2 or 3 categories)
Input (standard/console input)
153
505010205010505020205050505010
Output (standard/console output)
40
1(50)2(50)5(50)7(50)8(50)11(50)12(50)13(50)14(50)
4(20)9(20)10(20)
3(10)6(10)15(10)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional SQL Server 2000 Database Design

Authors: Louis Davidson

1st Edition

1861004761, 978-1861004765

More Books

Students also viewed these Databases questions

Question

In what sense is duration a measure of market risk?

Answered: 1 week ago

Question

Discuss the various types of policies ?

Answered: 1 week ago

Question

Briefly explain the various types of leadership ?

Answered: 1 week ago

Question

Explain the need for and importance of co-ordination?

Answered: 1 week ago

Question

Explain the contribution of Peter F. Drucker to Management .

Answered: 1 week ago