There is n boys and m Girls attending a theatre club. To set a play "The Big Bang theory", they need to choose a group containing exactly T actors containing no le SS than 4 boys and no less than one girl. How many ways is there to choose a group? Of course, the variants that is only differ in the composition of the troupe is considered different.
Perform all calculations in the 64-bit type: a long long forс/с++, int64 for Delphi and long for Java.
Input
The only line of the input data contains three integers n, m, t (4≤ n ≤30, 1≤ m ≤ 30, 5≤ t ≤ n + m).
Output
Find the required number of ways.
%lld Specificator to read or write 64-bit integers inс++. It is preferred to use CIN, cout streams or the%i64d specificator.
Sample Input
Input
5 2 5
Output
10
Input
4 3 5
Output
3
n Individuals, boys more than four, girls more than one, high school's permutation combination
1#include <iostream>2#include <cstdio>3#include <cmath>4typedefLong Longll;5 using namespacestd;6 ll Fun (ll A, ll b)7 {8ll temp=1;9 for(intj=1;j<=b; J + +)Ten { Onetemp=temp*a/J; Aa--; - } - returntemp; the } - intMain () - { - ll M,n,t; + inti,j; -Cin>>m>>n>>T; +ll sum=0; A for(i=4; i<t&&i<=m;i++) at { - if(t-i>=1&&t-i<=t-4&&t-i<=N) -Sum=sum+fun (m,i) *fun (n,t-i); - } -cout<<sum<<Endl; - return 0; in}
Codeforces 131C C (combination)