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 |
Re:Hellp! My code here ! plz give me some test data,i'm always wa, thx a lot!In Reply To:Re:Hellp! My code here ! plz give me some test data,i'm always wa, thx a lot! Posted by:ACM06019 at 2006-10-13 12:00:10 Sorry code here! #include <stdio.h> #define maxn 4501 #define MOD 1000000007 int dp[maxn][maxn]; int main() { int n,m,i,j; scanf("%d%d",&m,&n); for (i=0; i<=m; i++) dp[1][i]=dp[0][i]=1; for (i=0; i<=n; i++) dp[i][1]=dp[i][0]=1; for (i=2; i<=n; i++) for (j=2; j<=i && j<=m; j++) { if (i-j<=j) dp[i][j] = (dp[i][j-1]+dp[i-j][i-j])%MOD; else dp[i][j]=(dp[i][j-1]+dp[i-j][j]) % MOD; } if (m<=n) printf("%d",dp[n][m]); else printf("%d",dp[n][n]); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator