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 "stdio.h" long long d[201][201]; long long dp(int N,int M) { int i,j; for (i=0;i<=M;i++) { d[1][i]=1; d[0][i]=1; } for (i=0;i<=N;i++) { d[i][1]=1; d[i][0]=1; } for (i=2;i<=N;i++) for (j=2;j<=M;j++) { if (i>j) d[i][j]=d[i][j-1]+d[i-j][j]; else if (i==j) d[i][j]=d[i][i-1]+1; else d[i][j]=d[i][i]; } return d[N][M]; } int main() { int N,M; while (scanf ("%d%d",&N,&M)==2&&(N!=0||M!=0)) { printf ("%lld\n",dp(N-M,M) ); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator