标签:iss author images problems c11 并且 src tin memset
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 5422 Accepted Submission(s): 3185
#include<iostream> #include<cstdio> #include<cstring> using namespace std; #define maxn 121 int main() { int dp[maxn][maxn],num[maxn][maxn],T,n,m; scanf("%d",&T); while(T--) { scanf("%d%d",&n,&m); for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) scanf("%d",&num[i][j]); memset(dp,0,sizeof(dp)); dp[1][1]=1; for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { if(i==n&&j==m) continue; dp[i][j] %= 10000; for(int x=i;x<=num[i][j]+i&&x<=n;x++) { for(int y=j;y<=num[i][j]+j&&y<=m;y++) { if(x==i&&y==j) continue; if(num[i][j]>=x-i+y-j) { dp[x][y] += dp[i][j];//不断地把前面的得出的方法数加到后面,每一点就代表从起点到这一点的方法数 } } } } } dp[n][m] %= 10000; printf("%d\n",dp[n][m]); } return 0; }
标签:iss author images problems c11 并且 src tin memset
原文地址:http://www.cnblogs.com/l609929321/p/7157467.html