5 3 2 5 3 4 4 3 6 8 0
3 10 1 0 1
#include<iostream> #include<cstring> using namespace std; int main(){ int T; cin>>T; while(T--){ int n,m; cin>>n>>m; if(n<m) cout<<0<<endl; else{ long long a[31]={0}; a[0]=1; for(int i=1;i<=m;i++) a[i]=(n-i+1)*a[i-1]/i; cout<<a[m]<<endl; } } return 0; }
原文地址:http://blog.csdn.net/hyccfy/article/details/41450433