Description
One company's IT City decided to create a group of innovative developments consisting from 5 to 7 people and hire New employees for it. After placing a advertisment the company received N resumes. Now the HR department have to evaluate each possible group composition and select one of the them. Your Task is to count the number of variants of the group composition to evaluate.
Input
The only line of the input contains one integer n (7≤ n ≤777)-the number of potential EMP Loyees that sent resumes.
Output
Output one integer-the number of different variants of group composition.
Examples
input
7
Output
29
Choose from 5,6,7 A total number of choices from n individuals
#include <stdio.h>//#include <bits/stdc++.h> #include <string.h> #include <iostream> #include <math.h> #include <sstream> #include <set> #include <queue> #include <map> #include < vector> #include <algorithm> #include <limits.h> #define INF 0x7fffffff#define inf 0x7fffffffffffffff# Define Lson l,m,rt<<1#define Rson m+1,r,rt<<1|1#define LL long long#define ULL unsigned long longusing Namespa CE std; LL N; ULL C (int n,int m) { if (n<m) return 0; ULL Ans=1; for (int i=0;i<m;i++) ans=ans* (ULL) (n-i)/(ULL) (i+1); return ans;} ULL A (int n,int m) { if (n<m) return 0; ULL Ans=1; for (int i=0;i<m;i++) ans*= (ULL) (n-i); return ans;} int main () { cin>>n; Cout<<c (n,5) +c (n,6) +c (n,7) <<endl; return 0;}
Experimental educational round:volbit formulas Blitz F