- 马拦过河卒
- 2016-09-05 21:15:52 @
评测结果
编译成功
测试数据 #0: Accepted, time = 0 ms, mem = 560 KiB, score = 10
测试数据 #1: Accepted, time = 0 ms, mem = 560 KiB, score = 10
测试数据 #2: WrongAnswer, time = 0 ms, mem = 560 KiB, score = 0
测试数据 #3: Accepted, time = 0 ms, mem = 560 KiB, score = 10
测试数据 #4: Accepted, time = 0 ms, mem = 560 KiB, score = 10
测试数据 #5: Accepted, time = 0 ms, mem = 560 KiB, score = 10
测试数据 #6: Accepted, time = 0 ms, mem = 556 KiB, score = 10
测试数据 #7: Accepted, time = 0 ms, mem = 560 KiB, score = 10
测试数据 #8: Accepted, time = 0 ms, mem = 560 KiB, score = 10
测试数据 #9: Accepted, time = 0 ms, mem = 560 KiB, score = 10
WrongAnswer, time = 0 ms, mem = 560 KiB, score = 90
代码
#include <iostream>
using namespace std;
const int X[8] = {1,-1,1,-1,-2,-2,2,2};
const int Y[8] = {-2,-2,2,2,-1,1,1,-1};
int m,n,ans = 0,xx,yy,dp[31][31];
bool No[31][31];
inline int dfs(int x,int y) {
if (x < 0 || y < 0 || No[x][y]) return 0;
if (x == 0 && y == 0) return 1;
if (dp[x][y]) return dp[x][y];
else return dp[x][y] = dfs(x-1,y)+dfs(x,y-1);
}
int main() {
ios :: sync_with_stdio(false);
cin >> n >> m >> xx >> yy;
No[xx][yy] = true;
for (int i = 0;i < 8;i++)
if(yy+Y[i] >= 1 && xx+X[i] >= 1) No[xx+X[i]][yy+Y[i]] = true;
cout << dfs(n,m);
return 0;
}
0 条评论
目前还没有评论...