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

题意:给一个数n(7<=n<=777)要求从这n个人中抽5到7个问总共多少种可能
题解:组合数c(n,5)+c(n,6)+c(n,7)注意防止溢出
#include<stdio.h>
#include<string.h>
#include<string>
#include<math.h>
#include<algorithm>
#define LL long long
#define PI atan(1.0)*4
#define DD double
#define MAX 10010
#define mod 100
#define dian 1.000000011
#define INF 0x3f3f3f
using namespace std;
LL solve(LL n,LL m)
{
int num=1;
LL ans=1;
while(m--)
{
ans*=(n-m);
ans/=num;
num++;
}
return ans;
}
int main()
{
LL n,m,j,i,x,y;
LL sum,a,b,c,ans;
while(scanf("%lld",&n)!=EOF)
{
sum=0;
for(i=5;i<=7;i++)
{
sum+=solve(n,i);
}
printf("%lld\n",sum);
}
return 0;
}

  

codeforces 630F Selection of Personnel(组合数)的更多相关文章

  1. Codeforces 300C Beautiful Numbers 【组合数】+【逆元】

    <题目链接> 题目大意: 给出a和b,如果一个数每一位都是a或b,那么我们称这个数为good,在good的基础上,如果这个数的每一位之和也是good,那么这个数是excellent.求长度 ...

  2. codeforces 341C Iahub and Permutations(组合数dp)

    C. Iahub and Permutations time limit per test 1 second memory limit per test 256 megabytes input sta ...

  3. CodeForces 837F - Prefix Sums | Educational Codeforces Round 26

    按tutorial打的我血崩,死活挂第四组- - 思路来自FXXL /* CodeForces 837F - Prefix Sums [ 二分,组合数 ] | Educational Codeforc ...

  4. cf-公式专场

    A. Again Twenty Five! time limit per test 0.5 seconds memory limit per test 64 megabytes input stand ...

  5. Codeforces 100548F - Color (组合数+容斥)

    题目链接:http://codeforces.com/gym/100548/attachments 有n个物品 m种颜色,要求你只用k种颜色,且相邻物品的颜色不能相同,问你有多少种方案. 从m种颜色选 ...

  6. Codeforces GYM 100114 D. Selection 线段树维护DP

    D. Selection Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100114 Descriptio ...

  7. Educational Codeforces Round 26 F. Prefix Sums 二分,组合数

    题目链接:http://codeforces.com/contest/837/problem/F 题意:如题QAQ 解法:参考题解博客:http://www.cnblogs.com/FxxL/p/72 ...

  8. Codeforces 893E Counting Arrays:dp + 线性筛 + 分解质因数 + 组合数结论

    题目链接:http://codeforces.com/problemset/problem/893/E 题意: 共q组数据(q <= 10^5),每组数据给定x,y(x,y <= 10^6 ...

  9. Codeforces 869C The Intriguing Obsession:组合数 or dp

    题目链接:http://codeforces.com/problemset/problem/869/C 题意: 红色.蓝色.紫色的小岛分别有a,b,c个. 你可以在两个不同的岛之间架桥,桥的长度为1. ...

随机推荐

  1. oracle tns in linux

    [oracle@redhat4 admin]$ cd $ORACLE_HOME/network/admin[oracle@redhat4 admin]$ cat tnsnames.ora# tnsna ...

  2. WPF中的Drawing

    以前在用WinForm的时候,可以通过GDI+接口在窗体上动态绘制自定义的图形.在WPF中有没有对应的API呢,最近项目中用到了这个,在这里总结一下. WPF中的Drawing主要提供了几类API: ...

  3. Android log日志

    LOG是用来记录程序执行过程的机制,它既可以用于程序调试,也可以用于产品运营中的事件记录.在Android系统中,提供了简单.便利的LOG机制,开发人员可以方便地使用. androidsdk中提供了l ...

  4. git push

    使用git push直接推送未关联分支的时候,出现如下提示: $ git push Counting objects: 46, done. Delta compression using up to ...

  5. TCSRM 591 div2(1000)(dp)

    挺好的dp 因为有一点限制 必须任意去除一个数 总和就会小于另一个总和 换句话来说就是去除最小的满足 那么就都满足 所以是限制最小值的背包 刚开始从小到大定住最小值来背 TLE了一组数据 后来发现如果 ...

  6. LA 2572 (求可见圆盘的数量) Kanazawa

    题意: 把n个圆盘依次放到桌面上,按照放置的先后顺序给出这n个圆盘的圆心和半径,输出有多少个圆盘可见(即未被全部覆盖). 分析: 题中说对输入数据进行微小扰动后答案不变. 所露出的部分都是由若干小圆弧 ...

  7. asp.net正则表达式过滤标签和数据提取

    无论什么语言,正则表达式的处理方法都是非常灵活.高效的,尤其是对某些字符串的抓取.过滤方面,更显其优势. 正则表达式的写法通常比较简单,几行短代码便能轻松完成看似很复杂的事情,更值得称赞的是,它的执行 ...

  8. 求强连通分量模板(tarjan算法)

    关于如何求强连通分量的知识请戳 https://www.byvoid.com/blog/scc-tarjan/ void DFS(int x) { dfn[x]=lowlink[x]=++dfn_cl ...

  9. Sourcetree add Submodule

    LMXMN041:ximalaya will.wei$ git submodule add https://github.com/willbin/WeLib02.git Submodule Cloni ...

  10. 去除 waring Method 'CreateNew' hides virtual method of base type 'TCustomForm'

    最近整理前人的代码,有好多的hint和waring, 其中整理到Method 'CreateNew' hides virtual method of base type 'TCustomForm', ...