Experimental Educational Round: VolBIT Formulas Blitz F
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Experimental Educational Round: VolBIT Formulas Blitz F相关的知识,希望对你有一定的参考价值。
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.
The only line of the input contains one integer n (7 ≤ n ≤ 777) — the number of potential employees that sent resumes.
Output one integer — the number of different variants of group composition.
7
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; }
以上是关于Experimental Educational Round: VolBIT Formulas Blitz F的主要内容,如果未能解决你的问题,请参考以下文章
Experimental Educational Round: VolBIT Formulas Blitz D
Experimental Educational Round: VolBIT Formulas Blitz C
Experimental Educational Round: VolBIT Formulas Blitz F
C++ VS 错误:提供 std::experimental::filesystem 的 <experimental/filesystem> 标头已被 Microsoft 弃用,并将被删除