就是一个dp,数组内存的步数,

数组没清空,wa了一次

#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int step[110][110];
int main()
{
int N,P,M,T;
while(scanf("%d%d%d%d",&N,&P,&M,&T)!=EOF){
memset(step,0,sizeof(step));
step[0][P]=1;
for(int i=1;i<=M;i++){
for(int j=1;j<=N;j++){
if(step[i-1][j+1]!=0&&j+1<=N) step[i][j]+=step[i-1][j+1];
if(step[i-1][j-1]!=0&&j-1>=1) step[i][j]+=step[i-1][j-1]; }
}
// for(int i=1;i<=M;i++){
// for(int j=1;j<=N;j++){
// printf("%d ",step[i][j]);
// }
// printf("\n");
// }
printf("%d\n",step[M][T]);
}
return 0;
}

hdu 2151的更多相关文章

  1. (动态规划)Worm -- hdu -- 2151

    http://acm.hdu.edu.cn/showproblem.php?pid=2151 Worm Time Limit: 1000/1000 MS (Java/Others)    Memory ...

  2. HDU 2151 Worm

    Worm Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submissi ...

  3. hdu 2151 Worm (DP)

    Worm Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submis ...

  4. HDU——PKU题目分类

    HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 ...

  5. [转] HDU 题目分类

    转载来自:http://www.cppblog.com/acronix/archive/2010/09/24/127536.aspx 分类一: 基础题:1000.1001.1004.1005.1008 ...

  6. HDU ACM 题目分类

    模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 104 ...

  7. 转载:hdu 题目分类 (侵删)

    转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012. ...

  8. poj和hdu部分基础算法分类及难度排序

    最近想从头开始刷点基础些的题,正好有个网站有关于各大oj的题目分类(http://www.pythontip.com/acm/problemCategory),所以写了点脚本把hdu和poj的一些题目 ...

  9. HDOJ 2111. Saving HDU 贪心 结构体排序

    Saving HDU Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

随机推荐

  1. 2015 多校赛 第二场 1002 (hdu 5301)

    Description Your current task is to make a ground plan for a residential building located in HZXJHS. ...

  2. Hadoop MapReduce编程 API入门系列之挖掘气象数据版本2(十)

    下面,是版本1. Hadoop MapReduce编程 API入门系列之挖掘气象数据版本1(一) 这篇博文,包括了,实际生产开发非常重要的,单元测试和调试代码.这里不多赘述,直接送上代码. MRUni ...

  3. python课程设计笔记(五) ----Resuests+BeautifulSoup (爬虫入门)

    官方参考文档(中文版): requests:http://docs.python-requests.org/zh_CN/latest/user/quickstart.html beautifulsou ...

  4. python课程设计笔记(三)turtle绘图库(海龟库)

    实例:绘制一条蟒蛇 #turtle:绘图库(海龟库) import turtle turtle.setup(650,350,200,200) turtle.penup() turtle.fd(-250 ...

  5. junit使用第一弹

    知识点——断言 断言是编写测试用例的核心实现方式,即期望值是多少,测试的结果是多少,以此来判断测试是否通过. 1. 断言核心方法 assertArrayEquals(expecteds, actual ...

  6. 谷歌C++编程为何禁止缺省参数

    C++的缺省参数尽量不要使用,结果可能出乎我们的意料,下面的程序大家看看输出结果是多少? )                  cout << num << endl;     ...

  7. VHDL_LIB之DFF

    1 D-Flip-Flop with async reset or set library IEEE; use ieee.std_logic_1164.all; entity FFD is gener ...

  8. MySQL数据库的使用流程,代码解释+Hibernate连接数据库

    数据库的使用流程: 1.注册驱动: 2.用DriverManager.getConnection方法获得连接对象con: A方法:  3.用连接对象的createStatement()方法,获得可以执 ...

  9. 读书笔记「Python编程:从入门到实践」_3.列表简介

    3.1 列表是什么 列表 由一系列按特定顺序排列的元素组成. 在Python中,用方括号([] )来表示列表,并用逗号来分隔其中的元素. 3.1.1 访问列表元素 指出列表的名称,再指出元素的索引   ...

  10. phpstudy不显示目录列表---设置方法

    打开phpstudy,显示的项目文件路径不见了,其实是phpstudy的设置问题.以下是设置方法. 并将一下几个文件删除即可