题意:简单的来讲,就是求C(n,m).
但是这题有毒..TLE2发也是醉了..
必须循环较小的一个,否则就会TLE。。
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
using namespace std;
const int INF=0x3f3f3f3f;
const int Hashmaxn=100000;
const int maxn=10010;
typedef unsigned long long ULL;
ULL n,m;
ULL C(ULL n,ULL m){
ULL res=1;
for(ULL i=m+1,j=1;i<=n;i++,j++){
res=res*i/j;
}
return res;
}
int main(){
#ifndef ONLINE_JUDGE
freopen("test.in","r",stdin);
freopen("test.out","w",stdout);
#endif
while(cin>>n>>m){
if(!n&&!m) break;
if(n>m)
cout<<C(n+m,n)<<endl;
else
cout<<C(n+m,m)<<endl;
}
return 0;
}