NPTEL |The Joy of computing using Python | WEEK 11| Programming Assignment-1 Marks distribution

Publicado em: 05 Outubro 2019
no canal de: Ultimate Gamer
3,662
17

Given a list A of n elements, representing the marks. There are m students and you have to distribute the marks from the list A to m students such that:

1) Each student gets marks.
2) The difference between the maximum marks and minimum marks given to the students is minimised.

Input Format:
The first line contains the value n and m respectively separated by a space.
The second line contains the elements of list A separated by a space

Output Format:
Print the minimum difference

Example:

Input:
7 3
7 3 2 4 8 12 56

Output:
2

Explanation:
We need to pick 3 marks for three students (m=3). If we pick 2, 3 and 4, the difference is minimum which is 2.


Nesta página do site você pode assistir ao vídeo on-line NPTEL |The Joy of computing using Python | WEEK 11| Programming Assignment-1 Marks distribution duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Ultimate Gamer 05 Outubro 2019, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 3,662 vezes e gostou 17 espectadores. Boa visualização!