JustOj 1974: 简单的事情 (组合数)

题目描述

数学天才fans曾经说过一句话:组合数的计算是一件非常简单的事情。组合数的计算真的是一件非常简单的事情吗?请你自己去尝试一下吧!

输入

输入中的一些整数对n,m(m≤n≤20)

输出

输出其组合数。

样例输入
5 2
18 13
样例输出
10
8568 题解:组合数
 #include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <map>
#include <set>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f3f
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
ll gcd(ll a,ll b){
return b?gcd(b,a%b):a;
}
const int N=;
const int mod=1e9+;
void la(int x,int y)
{
ll n=,m=;
for(int i=y+;i<=x;i++)
n*=i;
for(int i=;i<=x-y;i++)
m*=i;
cout<<n/m<<endl;
}
int main()
{
std::ios::sync_with_stdio(false);
int n,m;
while(cin>>n>>m){
la(n,m);
}
return ;
}
上一篇:Linux 安装图形界面及远程连接


下一篇:git review报错一例