Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
dp........#include<iostream> #include<cmath> #include<cstdlib> #include<string.h> using namespace std; int main() { int a; cin>>a; while(a--) { int b,c; cin>>b>>c; int d[20][20]; for(int i=0;i<20;i++) for(int j=0;j<20;j++) d[i][j]=1; for(int i=2;i<=c;i++) for(int j=2;j<=b;j++) { if(j<i) d[j][i]=d[j][i-1]; else d[j][i]=d[j][i-1]+d[j-i][i]; } cout<<d[b][c]<<endl; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator