codeforces 630F Selection of Personnel
来源:互联网 发布:怎么搭建卡盟网站源码 编辑:程序博客网 时间:2024/05/22 12:55
F. Selection of Personnel
time limit per test
0.5 secondsmemory limit per test
64 megabytesinput
standard inputoutput
standard outputOne 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.
Examples
input
7
output
29
#include<cstdio>#include<cstring>#include<iostream>#include<cstdio>#include<cstring>#include<iostream>#include<algorithm>#include<cmath>using namespace std;//重点在于计算C(n,i) 要防止超时//题目大意:收到n个人的简历,要组成一个团队(人数为5或6或7)//即 计算C(n,5)+C(n,6)+C(n,7); long long C(long long n,long long i){//printf("%lld %lld\n",n,i);long long num=1;long long k,j;for(j=n,k=1;k<=i&&j>=n-i+1;k++,j--){num=num*j;num=num/k;}//printf("%lld\n",num);return num;}int main(){long long n;while(scanf("%lld",&n)!=EOF){if(n==5){printf("1\n");}else if(n==6){printf("7\n");}else if(n==7) {printf("29\n");}else{long long i;long long sum=0;for(i=7;i>=5;i--){sum=sum+C(n,i);}printf("%lld\n",sum);}}return 0;}
0 0
- Codeforces 630F - Selection of Personnel
- codeforces 630F Selection of Personnel
- CodeForces-630 F. Selection of Personnel【排列组合】
- codeforces #630 F. Selection of Personnel
- CodeForces-630F.Selection of Personnel
- Codeforces 630F Selection of Personnel ( C(a,b) )
- CodeForces 630 F. Selection of Personnel(组合数学)
- CodeForces - 630F Selection of Personnel (组合数学)
- Codeforces--630F--Selection of Personnel(组合数)
- Codeforces 630F:Selection of Personnel【数列组合】
- Codeforces--630F--Selection of Personnel(组合数)
- codeforces 630F Selection of Personnel(组合数)
- CodeForces 630F-Selection of Personnel【组合数学】
- Codeforces 630F Selection of Personnel 【组合数】
- codeforces_630F.Selection of Personnel
- Selection of Personnel
- CODEFORCES630F-Selection of Personnel
- Vocational Traits of research personnel
- GitHub基本命令
- 快速排序--QuickSort
- 系统组件预览
- 定义一个oracle的游标
- Emmet:HTML/CSS代码快速编写神器
- codeforces 630F Selection of Personnel
- 【JAVA】36、面向对象的封装性(下)
- 可展开的列表组件——ExpandableListView简单举例
- online_judge_1367
- linux中fork()函数详解
- MapReduce之InputFormat详解
- 26.手势识别之UILongPressGestureRecognizer
- 【通知】本博客迁移到 http://sparkyuan.me/
- Tribon数据库结构研究