您的位置:首页 > 其它

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
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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: