Codeforces Beta Round #95 (Div. 2) 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.
The only line of the input data contains three integers n, m, t (4 ≤ n ≤ 30, 1 ≤ m ≤ 30, 5 ≤ t ≤ n + m).
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.
5 2 5
10
4 3 5
3
思路:在4个男生1个女生的基础上暴力求组合数;不好描述见代码;
#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<queue>
#include<algorithm>
#include<stack>
#include<cstring>
#include<vector>
#include<list>
#include<set>
#include<map>
using namespace std;
#define ll long long
#define inf 2000000001
int scan()
{
int res = , ch ;
while( !( ( ch = getchar() ) >= '' && ch <= '' ) )
{
if( ch == EOF ) return << ;
}
res = ch - '' ;
while( ( ch = getchar() ) >= '' && ch <= '' )
res = res * + ( ch - '' ) ;
return res ;
}
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()
{
ll x,y,z,i,t;
scanf("%I64d%I64d%I64d",&x,&y,&z);
int b=,g=z-;
ll ans=;
for(i=;i<=x;i++)
{
b=i;
g=z-i;
if(g>y||g<)continue;
ans+=combine1(x,b)*combine1(y,g);
}
cout<<ans<<endl;
return ;
}
Codeforces Beta Round #95 (Div. 2) C. The World is a Theatre 组合数学的更多相关文章
- Codeforces Beta Round #95 (Div. 2) D.Subway
题目链接:http://codeforces.com/problemset/problem/131/D 思路: 题目的意思是说给定一个无向图,求图中的顶点到环上顶点的最短距离(有且仅有一个环,并且环上 ...
- codeforces水题100道 第二十六题 Codeforces Beta Round #95 (Div. 2) A. cAPS lOCK (strings)
题目链接:http://www.codeforces.com/problemset/problem/131/A题意:字符串大小写转换.C++代码: #include <cstdio> #i ...
- 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 ...
- 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 ...
- 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 ...
- Codeforces Beta Round #80 (Div. 2 Only)【ABCD】
Codeforces Beta Round #80 (Div. 2 Only) A Blackjack1 题意 一共52张扑克,A代表1或者11,2-10表示自己的数字,其他都表示10 现在你已经有一 ...
- Codeforces Beta Round #83 (Div. 1 Only)题解【ABCD】
Codeforces Beta Round #83 (Div. 1 Only) A. Dorm Water Supply 题意 给你一个n点m边的图,保证每个点的入度和出度最多为1 如果这个点入度为0 ...
- Codeforces Beta Round #79 (Div. 2 Only)
Codeforces Beta Round #79 (Div. 2 Only) http://codeforces.com/contest/102 A #include<bits/stdc++. ...
- Codeforces Beta Round #77 (Div. 2 Only)
Codeforces Beta Round #77 (Div. 2 Only) http://codeforces.com/contest/96 A #include<bits/stdc++.h ...
随机推荐
- [django]django的orm查询
实体 实体 出版社 category 作者 tag 书 文章 先学习一下基础的增删查改 django orm增删改查: https://www.cnblogs.com/iiiiiher/article ...
- shell脚本变量$#,$*,$$,$@,$0,$1,$2,$?的含义
本文转录:https://blog.csdn.net/kejiaming/article/details/51859503 参数说明: $# 是传给脚本的参数个数 $ 是脚本本身的名字 $ 是传递给该 ...
- QC质量管理七大手法
1.层别法 层别法就是将大量有关某一特定主题的观点.意见或想法按组分类,将收集到的大量的数据或资料按相互关系进行分组,加以层别.层别法一般和柏拉图.直方图等其它七大手法结合使用,也可单独使用. 2.查 ...
- SQL查询日历
这东西给自己留着用. 经常会用到一些查询需要做全月统计,但有些时候的统计需要将未发生日期也显示出来,因此会需要一个固定的日期表,(T6的自定义查询估计也是需要的,至少以前是这样) 下面写两种方法来获取 ...
- LoadRunner 自动关联、手动关联的帖子
https://www.guru99.com/correlation-in-loadrunner-ultimate-guide.html 这个网页里介绍了关联的概念,自动关联和手动关联的知识...
- 页面点击,不是a标签也会刷新原因
页面点击,不是a标签也会刷新原因 点击事件冒泡,触发了a链接导致整个页面刷新了.直接阻止 事件冒泡即可 例子: $("tr .am-text-danger").click(func ...
- NetSuite助力各行业企业快速发展
Oracle NetSuite今天发布了一系列全新技术创新,帮助各行各业企业提升收入.海外扩张以及赋能更多业务用户.最新推出的商务管理.财务管理和分析能力可协助企业利用NetSuite平台来超越客户预 ...
- Unity3D关于VR的Demo(一)
https://blog.csdn.net/qq_15807167/article/details/52048998?locationNum=8&fps=1 阅读数:9716 最近有点忙,只有 ...
- 获取Json字符串中的key和value
获取Json字符串中的key和value 在web项目中经常会用到json数据(如:struts2处理请求返回json数据给jsp解析),因此,JSONObject对象是必备的,这时就需要引入相关的j ...
- Linux 系统版本信息
1.# uname -a (Linux查看版本当前操作系统内核信息) 2.# cat /proc/version (Linux查看当前操作系统版本信息) 3.# cat /etc/issue 或 ...