CodeForces - 630F Selection of Personnel (组合数学)

CodeForces - 630F
Selection of Personnel
Time Limit: 500MS   Memory Limit: 65536KB   64bit IO Format: %I64d & %I64u

Submit Status

Description

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.

Sample Input

Input
7
Output
29

Source

Experimental Educational Round: VolBIT Formulas Blitz
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#define INF 0x3f3f3f3f
#define ll long long
#define N 10010
#define M 1000000007
using namespace std;
ll C(ll n,ll x)
{
	ll i,j,s=1;
	for(i=n,j=1;i>n-x;i--,j++)
		s*=i,s/=j;
	return s;
}
int main()
{
	int n;
	while(scanf("%d",&n)!=EOF)
	{
		ll sum=C(n,5)+C(n,6)+C(n,7);
		printf("%lld\n",sum);
	}
	return 0;
}

你可能感兴趣的:(CodeForces - 630F Selection of Personnel (组合数学))