Codeforces--630F--Selection of Personnel(组合数)
2016-03-08 17:12
393 查看
[align=center]F -Selection of Personnel[/align]
Crawling in process...Crawling failedTime
Limit:500MS Memory Limit:65536KB
64bit IO Format:%I64d & %I64u
SubmitStatus
Description
One company of IT City decided to create a group of innovative developments consisting from5 to
7 people and hire new employees for it. After placing an advertisment the company receivedn resumes. Now the HR department has to evaluate each possible group composition and select one of
them. Your task is to count the number of variants of group composition to evaluate.
Input
The only line of the input contains one integer n (7 ≤ n ≤ 777) — the number of potential employees that sent resumes.
Output
Output one integer — the number of different variants of group composition.
Sample Input
Input
Output
[align=center]F -Selection of Personnel[/align]
Crawling in process...Crawling failedTime
Limit:500MS Memory Limit:65536KB
64bit IO Format:%I64d & %I64u
SubmitStatus
Description
One company of IT City decided to create a group of innovative developments consisting from5 to
7 people and hire new employees for it. After placing an advertisment the company receivedn resumes. Now the HR department has to evaluate each possible group composition and select one of
them. Your task is to count the number of variants of group composition to evaluate.
Input
The only line of the input contains one integer n (7 ≤ n ≤ 777) — the number of potential employees that sent resumes.
Output
Output one integer — the number of different variants of group composition.
Sample Input
Input
7
Output
29
给n个人,然后判断从中取出5,6,7个人的情况有多少,C(n,5)+C(n,6)+C(n,7)
#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; __int64 C(__int64 n,__int64 m) { int num=1; __int64 ans=1; while(m--) { ans*=(n-m); ans/=num; num++; } return ans; } int main() { __int64 n; while(cin>>n) { __int64 ans=0; for(__int64 i=5;i<=7;i++) ans+=C(n,i); cout<<ans<<endl; } }
相关文章推荐
- Swift的一些基本属性2 (控制流)
- CodeForces 632A-Grandma Laura and Apples
- Photoshop快速复制图层的几种方法和技巧
- NSInputStream 和 NSOutputStream
- 菜鸟教程 Python100例 之实例29
- Jsoup解析HTML、加载文档等实例
- Codeforces--630F--Selection of Personnel(组合数)
- linux系统Qt调用opencv的编译过程(ubuntu14.04 kylin+qt5.5+opencv2.4.10)
- 基于jQuery的网页影音播放器jPlayer的基本使用教程
- 关于eclipse 部署tomcat和将项目部署到tomcat的webapps
- 图
- CodeForces 630H- Benches【组合数学】
- JS键盘事件种类、兼容和优化
- iOS中的单例
- 概念模型 - Conceptual Data Model
- 对网络日志分析的几个方面
- java 自定义标签
- arcmap 图层集数据提取
- ASP.NET-019:UpdatePanel中无法使用Response问题
- 【分享】通过Excel生成批量SQL语句,处理大量数据的好办法