1234567891011121314151617181920 |
- #include<bits/stdc++.h>
- using namespace std;
- typedef long long LL;
- LL cnr(int n,int r){
- if(r*2>n){
- r=n-r;
- }
- LL p=1LL;
- for(int i=0;i<r;i++)p*=(n-i);
- for(int i=2;i<=r;i++)p/=i;
- return p;
- }
- int main() {
- int m,n;
- while(cin>>m>>n){
- cout<<cnr(m,n)<<endl;
- }
- return 0;
- }
|