Experimental Educational Round: VolBIT Formulas Blitz F
2016-02-24 20:35
393 查看
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.
Examples
input
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 从n个人中选5,6,7个一共多少种选法
#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 long using namespace 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; }
相关文章推荐
- mini2440烧卡失败的两个原因总结
- 51nod 1495 中国好区间
- 微信公众平台开发: 获取用户基本信息
- 在计算机视觉中的李群、李代数
- 如何编写函数才能提高代码质量总结
- POJ - 1915 Knight Moves
- Spring中自己主动装配
- 普通插入排序与成对插入排序
- NOIP2015 运输计划(二分+LCA+差分)
- CODEFORCES 629 C Famil Door and Brackets
- https://projecteuler.net/problem=7
- Anaconda下import caffe出现错误TypeError: 'module' object is not callable
- hdu 1257 最少拦截系统
- 签名解密,内容验证
- 忘记电商 刘强东和京东的“如意算盘”
- Linux 下IOport编程訪问
- 2016/2/24 . html . htm . shtml 的区别
- 【转】测试思考——测试人员需要具备哪些素质?
- Java中Comparable和Comparator区别小结
- SDUT 汤圆の糖(递推算法)