| ||||||||||
| 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 | |||||||||
Hellp! My code here ! plz give me some test data,i'm always wa, thx a lot!#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++)
{
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