f(n,k)=f(0,k-1)+f(1,k-1)+.......f(n,k-1)
#include <iostream> #include <cstring> using namespace std; int main() { int n,k,i,j,a[105][105],l; while(cin>>n>>k&&(n+k)) { memset(a,0,sizeof(a)); for(i=1;i<=k;i++) for(j=0;j<=n;j++) { if(i==1) a[j][i]=1; else for(l=0;l<=j;l++) { a[j][i]+=a[l][i-1]; if(a[j][i]>100000000) a[j][i]%=1000000; } } cout<<a[n][k]%1000000<<endl; } return 0; }