C. The world is a theatre

Source: Internet
Author: User
Time limit per test

2 seconds

Memory limit per test

256 megabytes

Input

Standard Input

Output

Standard output

There are n boys and m girls
attending Theater Club. to set a play "The Big Bang Theory", they need to choose a group containing exactly T actors containing no less
than 4 boys and no less than one girl. how many ways are there to choose a group? Of course, the variants that only differ in the composition of the troupe are considered different.

Perform all calculations in the 64-bit type:Long longFor tables/Tables ++,Int64For
Delphi andLongFor Java.

Input

The only line of the input data contains three IntegersN,M,T(4 bytes ≤ bytesNLimit ≤ Limit 30, limit 1 limit ≤ limitMLimit ≤ Limit 30, limit 5 limit ≤ limitTLimit ≤ limitNRegion + RegionM).

Output

Find the required number of ways.

Please do not use the % LLD specificator to read or write 64-bit integers in memory ++. It is preferred to use Cin, cout streams or the % i64d specificator.

Sample test (s) Input
 
5 2 5
Output
10
Input
 
4 3 5
Output
3

Problem solving Description: This is a typical DP problem. According to the solution of the DP problem, it is nothing more than making a table first and then determining the specified location. In this question, we use C [I] [J] to represent the number of candidates for selecting J as an actor from I, so we can obtain the following transfer equation:

C [I] [J] = C [I-1] [J-1] + C [I-1] [J];

That is, either select the I-1 from the J-1 individual, plus the first I; or select the J from the I-1. The final result is to count the sum of C [N] [I] * C [m] [t-I] from I = 4 until the end of the T-1 [I] boys and girls]

# Include <iostream> # include <cstdio> # include <cstdlib> # include <cmath> # include <cstring> # include <string> # include <set> # include <algorithm> using namespace STD; long long C [64] [64]; long res; int main () {int n, m, T; int I, J; scanf ("% d", & N, & M, & T); for (I = 0; I <= 30; I ++) {c [I] [0] = 1; for (j = 1; j <= I; j ++) {c [I] [J] = C [I-1] [J-1] + C [I-1] [J] ;}res = 0; for (I = 4; I <t; I ++) {res + = C [N] [I] * C [m] [t-I];} printf ("% LLD \ n ", res); Return 0 ;}

 

Related Article

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.