0
点赞
收藏
分享

微信扫一扫

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



Time Limit: 500MS

 

Memory Limit: 65536KB

 

64bit IO Format: %I64d & %I64u

CodeForces - 630F


Selection of Personnel



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






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;
}





举报

相关推荐

并查集+组合数学

0 条评论