Показать сообщение отдельно
  #1 (permalink)  
Старый 06.06.2019, 19:21
Аспирант
Отправить личное сообщение для gsdev99 Посмотреть профиль Найти все сообщения от gsdev99
 
Регистрация: 03.02.2019
Сообщений: 72

Как решить следующую задачу (Diverse Deputation)?
Всем привет. Недавно увидел такую задачу. Но возникли сложности с решением. Был бы благодарен вашей помощи.

There are m men and w women. A deputation of exactly 3 people has to be formed from them. A deputation is diverse if and only if it contains at least one man and at least one woman. How many distinct ways are there to select a diverse deputation of 3 people? Two deputations are different if and only if one deputation has a member which the other does not have.
Find the number of ways to select a diverse deputation of 3 people.

Function Description
Complete the function diverseDeputation in the editor below. The function must return an integer which is the number of ways to select a diverse deputation from m men and w women.


Constraints
0 ≤ m, w ≤ 1000


/*
* Complete the 'diverseDeputation' function below.
*
* The function is expected to return an INTEGER.
* The function accepts following parameters:
* 1. INTEGER m
* 2. INTEGER w
*/

function diverseDeputation(m, w) {
// Write your code here
}

Последний раз редактировалось gsdev99, 06.06.2019 в 19:25.
Ответить с цитированием