C. The World is a Theatre
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 a theatre 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 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.

Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specificator.

Examples
Input
5 2 5
Output
10
Input
4 3 5
Output
3

题意:n个男生 m个女生 选t个人 男生最少4个 女生最少1个 问有多少种选择方式

题解:组合数学 数据范围很小 求组合数 直接公式线性处理或者杨辉三角处理 C(n,m)=n!/m!(n-m)! 
  注意在男生为4,女生为1的基础上暴力求。枚举男生的人数i=(4~t-1)ΣC(n,i)*C(m,t-i)
 #include<iostream>
#include<cstring>
#include<cstdio>
#define ll long long
using namespace std;
ll n,m,t;
ll ans;
ll combine1(ll n,ll m) //计算组合数C(n,m)
{
ll sum=; //线性计算
for(ll i=,j=n;i<=m;i++,j--)
sum=sum*j/i;
return sum;
}
int main()
{
scanf("%I64d %I64d %I64d",&n,&m,&t);
for(int i=;i<=t-;i++)
{
ans=ans+combine1(n,i)*combine1(m,t-i);
}
printf("%I64d\n",ans);
}

最新文章

  1. 执行动态sql返回参数
  2. js将数字转换成大写的人民币表达式
  3. c#观察者模式学习笔记(1)
  4. git branch(转)
  5. 克隆虚拟机win8系统后注意修改安全标识(SID)
  6. httpClient 发送请求后解析流重用的问题(HttpEntity的重用:BufferedHttpEntity)
  7. 学习CSS记录:选择符优先级
  8. LVS的NAT模式测试
  9. 关于Oracle-SQL语句性能优化
  10. CASE WHEN 高阶用法?
  11. JAVA WEB开发环境与搭建
  12. Appium(二)---启动App+模拟滑动
  13. 分享一个前后端分离的web项目(vue+spring boot)
  14. spring boot默认访问静态资源
  15. JMeter 脚本开发(五)
  16. jvm的调优
  17. Pandas初学者代码优化指南
  18. String、StringBuffer、StringBuilder和StringTokenizer的区别
  19. Java Future源码分析
  20. sublime配置

热门文章

  1. Symmetric Difference-freecodecamp算法题目
  2. C++ 容器与继承
  3. 基于Qt Creator实现中国象棋人机对战, c++实现
  4. LGTB 学分块
  5. 二、Linux 系统启动过程
  6. Linux时区修改
  7. 第39-43课 thinkphp5完成商品会员价格功能(后置勾子afterInsert)
  8. Java总结 - List实现类ArrayList&amp;LinkedList
  9. python3+openCV实现图片的人脸人眼检测,原理+参数+源代码
  10. Find a path HDU - 5492 (dp)