codeforces 630F Selection of Personnel

来源:互联网 发布:怎么搭建卡盟网站源码 编辑:程序博客网 时间:2024/05/22 12:55
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.

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