Codeforces 630F - Selection of Personnel
2016-03-08 19:26
351 查看
http://www.codeforces.com/problemset/problem/630/F
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.
Examples
input
output
//排列组合 计算Cn5+Cn6+Cn7的值
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.
Examples
input
7
output
29
//排列组合 计算Cn5+Cn6+Cn7的值
#include <cstdio> //33319741730082870 #define LL __int64 LL zuHe(LL n,int m) { if(n<m) return 0; if(n==m) return 1; LL ans=1; int j=2; for(int i=n-m+1;i<=n;++i) { ans*=i; while(j<=m&&ans%j==0) { ans/=j; ++j; } } while(j<=m) { ans/=j; ++j; } return ans; } int main() { LL n; while(~scanf("%I64d",&n)) { LL ans=0; for(int i=5;i<=7;++i) { ans+=zuHe(n,i); } printf("%I64d\n",ans); } return 0; }
相关文章推荐
- wait和notifyAll的方法使用案例分析
- Retrofit 代替 HttpRequest
- [转]Python os.path模块
- Uva10976——Fractions Again?!
- JAVA的agent使用总结(用ASM进行操作)
- Codeforces 86C Genetic engineering(AC自动机+DP)
- C语言中参数的传递
- POJ_P2311 Cutting Game(博弈+SG函数)
- infinite scroll和masonry实现的json类型瀑布流
- SpringMVC的两个简单入门的例子(-)
- 让多个Fragment 切换时不重新实例化
- 基本算法prim学习总结性文章
- ZOJ 3926 Parity Modulo P(XJB)
- ZOJ 3923 In the Rain(数学)
- C++中的继承和组合区别使用
- 项目2胖子不想说体重
- 弱网络下的游戏服务器设计
- 文章标题
- 代码才是公司资产
- 新学期新计划