CodeForces 630F-Selection of Personnel【组合数学】
2016-03-09 21:22
471 查看
F. Selection of Personnel
time limit per test
0.5 seconds
memory limit per test
64 megabytes
input
standard input
output
standard output
One company of IT City decided to create a group of innovative developments consisting from 5 to 7 people
and hire new employees for it. After placing an advertisment the company received n 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.
注意:计算组合数学不要超long long。
Examples
input
output
time limit per test
0.5 seconds
memory limit per test
64 megabytes
input
standard input
output
standard output
One company of IT City decided to create a group of innovative developments consisting from 5 to 7 people
and hire new employees for it. After placing an advertisment the company received n 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.
注意:计算组合数学不要超long long。
Examples
input
7
output
29
#include<stdio.h> #include<string.h> #include<algorithm> #define LL __int64 using namespace std; int n; LL CC(int x,int mm) { LL oo=1; int i,j=0; int yy=1; for(i=mm;i>=1;i--) { oo=oo*(x-j); oo/=yy; x--; yy++; } return oo; } int main() { while(scanf("%d",&n)!=EOF) { LL a,b,c; a=CC(n,7); b=CC(n,6); c=CC(n,5); printf("%I64d\n",a+b+c); } return 0; }
相关文章推荐
- HTML+CSS基础篇(三)——CSS样式基础
- 56.银行里的迷宫(未解决题目)
- 对于软件的点评
- 56.银行里的迷宫(未解决题目)
- 56.银行里的迷宫(未解决题目)
- 56.银行里的迷宫(未解决题目)
- CODE[VS] 1169 传纸条
- 判断一个单链表是否有环及环的链接点
- VMWare中安装Windows Server2012无法启动的解决方案
- Spring 的容器
- Apache Mahout 简介 通过可伸缩、商业友好的机器学习来构建智能应用程序
- Java多线程实现异步调用
- 对比: Java EE EJB和 Spring Java Bean
- 在CentOS 6.5里添加一块硬盘,分区并格式化后,挂载到/data下
- flex布局
- 一起学libcef--给你的浏览器删除cookie
- Dubbo与Zookeeper、SpringMVC整合和使用(负载均衡、容错)
- 欢迎使用CSDN-markdown编辑器
- Lua中的table函数库
- 一起学libcef--给你的浏览器删除cookie