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 |
我的代码,动态规划# include <iostream> using namespace std; int main() { int b[11][11]; int t,m,n; cin>>t; for(int i=0;i<t;i++) { cin>>m>>n; for(int j=1;j<=n;j++) b[1][j]=1; for(int i=2;i<=m;i++) b[i][1]=1; for(int i=0;i<=n;i++) b[0][i]=1; for(int i=2;i<=m;i++) for(int j=2;j<=n;j++) { b[i][j]=0; for(int k=0;k<=i/j;k++) { b[i][j]=b[i][j]+b[i-k*j][j-1]; } } cout<<b[m][n]<<endl; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator