49. 跳马问题

水题

dfs裸基础

#include<cstdio>

using namespace std;
int n,m,mx[]={,,,,},
ans,my[]={,-,,-,};
inline void dfs(int x,int y){
if(x==m&&y==n){ ans++; return;}
for(int i=;i<=;i++){
int tx=mx[i]+x,ty=my[i]+y;
if(tx>&&ty>&&tx<=m&&ty<=n)
dfs(tx,ty);
}
}
int main()
{
freopen("horse.in","r",stdin);
freopen("horse.out","w",stdout);
scanf("%d%d",&n,&m);
dfs(,);
printf("%d",ans);
return ;
}

cogs——49. 跳马问题的更多相关文章

  1. cogs 49. 跳马问题

    49. 跳马问题 ★   输入文件:horse.in   输出文件:horse.out   简单对比时间限制:1 s   内存限制:128 MB [问题描述] 有一只中国象棋中的 “ 马 ” ,在半张 ...

  2. cogs 49. 跳马问题 DFS dp

    49. 跳马问题 ★   输入文件:horse.in   输出文件:horse.out   简单对比时间限制:1 s   内存限制:128 MB [问题描述] 有一只中国象棋中的 “ 马 ” ,在半张 ...

  3. noj -> 跳马

    00 题目 描述: 在国际象棋中,马的走法与中车象棋类似,即俗话说的"马走日",下图所示即国际象棋中马(K)在一步能到达的格子(其中黑色的格子是能到达的位置). 现有一200*20 ...

  4. 49. 3种方法实现复杂链表的复制[clone of complex linked list]

    [本文链接] http://www.cnblogs.com/hellogiser/p/clone-of-complex-linked-list.html [题目] 有一个复杂链表,其结点除了有一个ne ...

  5. chrome浏览器的跨域设置——包括版本49前后两种设置

    做前后分离的webapp开发的时候,出于一些原因往往需要将浏览器设置成支持跨域的模式,好在chrome浏览器就是支持可跨域的设置,网上也有很多chrome跨域设置教程.但是新版本的chrome浏览器提 ...

  6. PHP5.3.3+Apache2.2.16+MySQL5.1.49

    轻松配置PHP5.3.3+Apache2.2.16+MySQL5.1.49,下面是有详细的步骤说明.   第一步:下载安装的文件 1. MySQL:下载地址mysql-5.1.49-win32.msi ...

  7. LeetCode - 49. Group Anagrams

    49. Group Anagrams Problem's Link ------------------------------------------------------------------ ...

  8. CodeForce Round#49 untitled (Hdu 5339)

    Untitled Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Su ...

  9. 【COGS 254】【POI 2001】交通网络图

    http://www.cogs.top/cogs/problem/problem.php?pid=254 dist[i]表示能最早到达i点的时间.这样就可以用最短路模型来转移了. #include&l ...

随机推荐

  1. LeetCode 242. Valid Anagram (验证变位词)

    Given two strings s and t, write a function to determine if t is an anagram of s. For example,s = &q ...

  2. LeetCode 21. Merge Two Sorted Lists (合并两个有序链表)

    Merge two sorted linked lists and return it as a new list. The new list should be made by splicing t ...

  3. HDU 5311 Sequence

    Hidden String Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) ...

  4. BestCoder Round #60.1003.GT and set/HDU5506 dfs

    GT and set  Accepts: 35  Submissions: 194  Time Limit: 2000/1000 MS (Java/Others)  Memory Limit: 655 ...

  5. YTU 2795: 编程题AB-侦察员的密码

    2795: 编程题AB-侦察员的密码 时间限制: 1 Sec  内存限制: 128 MB 提交: 155  解决: 43 题目描述 侦察员小甲在被捕前在墙上写了两行文字(ASCII字符),其中包含了他 ...

  6. Flink之Window Operation

    目录 Configuring Time Characteristics Process Functions Window Operators Applying Functions on Windows ...

  7. Network(Tarjan+LCA)

    http://poj.org/problem?id=3417 元宵节+情人节晚上刷的题,纪念一下.. 题意:给出n个点,m条边,然后Q个询问,每次询问输入一条边,输出加入此边后桥的个数.. #incl ...

  8. Akka源码分析-local-DeathWatch

    生命周期监控,也就是死亡监控,是akka编程中常用的机制.比如我们有了某个actor的ActorRef之后,希望在该actor死亡之后收到响应的消息,此时我们就可以使用watch函数达到这一目的. c ...

  9. akka设计模式系列-Aggregate模式

    所谓的Aggregate模式,其实就是聚合模式,跟masterWorker模式有点类似,但其出发点不同.masterWorker模式是指master向worker发送命令,worker完成某种业务逻辑 ...

  10. 使用HBuilder新建项目

    依次点击文件→新建→选择Web项目(按下Ctrl+N,W可以触发快速新建(MacOS请使用Command+N,然后左键点击Web项目)) 如上图,请在A处填写新建项目的名称,B处填写(或选择)项目保存 ...