code vs 1216 跳马问题

 时间限制: 1 s
 空间限制: 128000 KB
 题目等级 : 黄金 Gold
 
 
 
题目描述 Description

题目

code vs 1216 跳马问题

输入描述 Input Description

第一行两个正整数M,N(0<M,N≤300)分别表示行和列
第二行两个正整数,表示起点的行列坐标。
第三行两个正整数,表示终点的行列坐标

输出描述 Output Description

一个正整数,表示方案总数对123456求余

样例输入 Sample Input

3 3

1 1

2 3

样例输出 Sample Output

1

数据范围及提示 Data Size & Hint

1

分类标签 Tags 点此展开

思路:记忆化搜索,爆搜gg。

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define mod 123456
using namespace std;
int f[][];
int n,m,sx,sy,tx,ty,ans;
int dfs(int x,int y){
if(x<||x>n||y<||y>m) return ;
if(f[x][y]) return f[x][y];
return f[x][y]+=(dfs(x-,y-)+dfs(x-,y+)+dfs(x-,y-)+dfs(x-,y+));
}
int main(){
scanf("%d%d%d%d%d%d",&n,&m,&sx,&sy,&tx,&ty);
f[sx][sy]=;
dfs(tx,ty);
cout<<f[tx][ty]%mod;
}
上一篇:Linux dd——备份命令


下一篇:Linux 系统下使用dd命令备份还原MBR主引导记录