记录编号 | 374362 | 评测结果 | AAAAAAAAAA | ||
---|---|---|---|---|---|
题目名称 | 跳马问题 | 最终得分 | 100 | ||
用户昵称 | 是否通过 | 通过 | |||
代码语言 | C++ | 运行时间 | 0.003 s | ||
提交时间 | 2017-02-22 21:44:26 | 内存使用 | 4.13 MiB | ||
- #include<iostream>
- #include<cstdio>
- using namespace std;
- int dp[1000][1000];
- int x,y;
- int main()
- {
- freopen("horse.in","r",stdin);
- freopen("horse.out","w",stdout);
- scanf("%d%d",&y,&x);
- dp[1][1]=1;
- for(int i=2;i<=x;++i)
- for(int j=1;j<=y;++j)
- {
- if(j+2<=y)dp[i][j]+=dp[i-1][j+2];
- if(j-2>=0)dp[i][j]+=dp[i-1][j-2];
- dp[i][j]+=(dp[i-2][j+1]+dp[i-2][j-1]);
- }
- cout<<dp[x][y];
- }