C. The World is a Theatre

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 nmt (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
  1. 5 2 5
output
  1. 10
input
  1. 4 3 5
output
  1. 3
    思路:在4个男生1个女生的基础上暴力求组合数;不好描述见代码;
       
  1. #include<iostream>
  2. #include<cstdio>
  3. #include<cmath>
  4. #include<string>
  5. #include<queue>
  6. #include<algorithm>
  7. #include<stack>
  8. #include<cstring>
  9. #include<vector>
  10. #include<list>
  11. #include<set>
  12. #include<map>
  13. using namespace std;
  14. #define ll long long
  15. #define inf 2000000001
  16. int scan()
  17. {
  18. int res = , ch ;
  19. while( !( ( ch = getchar() ) >= '' && ch <= '' ) )
  20. {
  21. if( ch == EOF ) return << ;
  22. }
  23. res = ch - '' ;
  24. while( ( ch = getchar() ) >= '' && ch <= '' )
  25. res = res * + ( ch - '' ) ;
  26. return res ;
  27. }
  28. ll combine1(ll n,ll m) //计算组合数C(n,m)
  29. {
  30. ll sum=; //线性计算
  31. for(ll i=,j=n;i<=m;i++,j--)
  32. sum=sum*j/i;
  33. return sum;
  34. }
  35. int main()
  36. {
  37. ll x,y,z,i,t;
  38. scanf("%I64d%I64d%I64d",&x,&y,&z);
  39. int b=,g=z-;
  40. ll ans=;
  41. for(i=;i<=x;i++)
  42. {
  43. b=i;
  44. g=z-i;
  45. if(g>y||g<)continue;
  46. ans+=combine1(x,b)*combine1(y,g);
  47. }
  48. cout<<ans<<endl;
  49. return ;
  50. }

Codeforces Beta Round #95 (Div. 2) C. The World is a Theatre 组合数学的更多相关文章

  1. Codeforces Beta Round #95 (Div. 2) D.Subway

    题目链接:http://codeforces.com/problemset/problem/131/D 思路: 题目的意思是说给定一个无向图,求图中的顶点到环上顶点的最短距离(有且仅有一个环,并且环上 ...

  2. codeforces水题100道 第二十六题 Codeforces Beta Round #95 (Div. 2) A. cAPS lOCK (strings)

    题目链接:http://www.codeforces.com/problemset/problem/131/A题意:字符串大小写转换.C++代码: #include <cstdio> #i ...

  3. Codeforces Beta Round #95 (Div. 2) D. Subway dfs+bfs

    D. Subway A subway scheme, classic for all Berland cities is represented by a set of n stations conn ...

  4. Codeforces Beta Round #95 (Div. 2) C 组合数学

    C. The World is a Theatre time limit per test 2 seconds memory limit per test 256 megabytes input st ...

  5. Codeforces Beta Round #95 (Div. 2) D. Subway 边双联通+spfa

    D. Subway   A subway scheme, classic for all Berland cities is represented by a set of n stations co ...

  6. Codeforces Beta Round #80 (Div. 2 Only)【ABCD】

    Codeforces Beta Round #80 (Div. 2 Only) A Blackjack1 题意 一共52张扑克,A代表1或者11,2-10表示自己的数字,其他都表示10 现在你已经有一 ...

  7. Codeforces Beta Round #83 (Div. 1 Only)题解【ABCD】

    Codeforces Beta Round #83 (Div. 1 Only) A. Dorm Water Supply 题意 给你一个n点m边的图,保证每个点的入度和出度最多为1 如果这个点入度为0 ...

  8. Codeforces Beta Round #79 (Div. 2 Only)

    Codeforces Beta Round #79 (Div. 2 Only) http://codeforces.com/contest/102 A #include<bits/stdc++. ...

  9. Codeforces Beta Round #77 (Div. 2 Only)

    Codeforces Beta Round #77 (Div. 2 Only) http://codeforces.com/contest/96 A #include<bits/stdc++.h ...

随机推荐

  1. Hadoop集群安装-CDH5(5台服务器集群)

    CDH5包下载:http://archive.cloudera.com/cdh5/ 架构设计: 主机规划: IP Host 部署模块 进程 192.168.254.151 Hadoop-NN-01 N ...

  2. win 7 和 winserver 2008 下,布署网站遇到的错误解决方法

    本人亲测,有效. 1.如果只列出目录: web.config的system.webServer配置节下是否有这个: <modules runAllManagedModulesForAllRequ ...

  3. Qt界面控件值获取异常处理

    情景简述: 正常情况,我们从控件获取的值是OK的,但有时候就是奇怪的不对头,那么我们可以给获取后的值加上一个不痛不痒的函数,再返回,结果就OK了.至于原因嘛,[呲牙][呲牙] 比如: //正常情况 d ...

  4. 安卓备份 To Do(待办事项)的数据库

    真正路径:/data/data/com.mediatek.todos/databases/todos.db 使用过链接的路径:/data/user/0/com.mediatek.todos/datab ...

  5. Junit4用法

    序号 方法和描述 1 void assertEquals(boolean expected, boolean actual) 检查两个变量或者等式是否平衡 2 void assertTrue(bool ...

  6. JNDI—目录接口名

    1:什么是JNDI? Java名称与目录接口:java Naming and Directory Interface未开发人员提供的查找和访问各种名称和目录的 服务和接口 2:全局的上下文配置文件: ...

  7. 数据仓库基础(二)ETL

    本文转载自:http://www.cnblogs.com/evencao/archive/2013/06/14/3135529.html ETL在数据仓库中具有以下的几个特点: 数据流动具有周期性: ...

  8. Linux基础命令---shutdown

    shutdown shutdown指令以安全的方式来关闭系统,所有已经登录的用户都会被告知系统将要关闭.并且在最后五分钟内,新的登录将被阻止.过了指定的time后,关机会向init(8)守护进程发送一 ...

  9. schema与catalog的理解

    sql环境中Catalog和Schema都属于抽象概念,主要用来解决命名冲突问题.一个数据库系统包含多个Catalog,每个Catalog包含多个Schema,每个Schema包含多个数据库对象(表. ...

  10. python的时间处理-time模块

    time模块 时间的表示方法有三种: 时间戳:表示的是从1970年1月1日0点至今的秒数 格式化字符串表示:这种表示更习惯我们通常的读法,如2018-04-24 00:00:00 格式化元祖表示:是一 ...