题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=171

动态规划:

  d(i,j) = max{d(i-1, j), d(i, j-1)}+mp[i][j];

 #include<iostream>
 #include<cstdio>
 #include<cstring>
 #include<string>
 #include<algorithm>
 using namespace std;
 #define INF 0x7fffffff
 #define INPUT freopen("d:\\in.txt", "r", stdin);
 #define OUTPUT freopen("d:\\out.txt", "w", stdout);
 #define N 20

 int mp[N][N];
 int d[N][N];
 int m, n;

 int dp(int i, int j)
 {
      || j< || i>=m || j>=n)
         ;
     ) return d[i][j];
     ), dp(i-, j))+mp[i][j];
 } 

 int main()
 {
     //INPUT;
     while(~scanf("%d%d", &m, &n))
     {
         ; i<m; i++){
             ; j<n; j++){
                 scanf("%d", &mp[i][j]);
             }
         }
         memset(d, , sizeof(d));
         printf(, n-));
     }
     ;

[河南省ACM省赛-第三届] 聪明的kk (nyoj 171)的更多相关文章

  1. [河南省ACM省赛-第三届] 房间安排 (nyoj 168)

    题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=168 分析:找到一天中需要最多的房间即可 #include<iostream> ...

  2. [河南省ACM省赛-第三届] AMAZING AUCTION (nyoj 251)

    题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=251 规则: 1.若某竞标价唯一,则胜出 2.若不存在唯一竞标价,则投标次数最少竞标价中标 ...

  3. [河南省ACM省赛-第三届] BUYING FEED (nyoj 248)

    #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> us ...

  4. [河南省ACM省赛-第三届] 网络的可靠性 (nyoj 170)

    题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=170 根据题意,需要找到度数为1的结点个数,如下图: #include<iostre ...

  5. [河南省ACM省赛-第三届] 素数 (nyoj 169)

    #include <iostream> #include <cstdio> #include <queue> #include <cstring> #i ...

  6. [河南省ACM省赛-第四届] 序号互换 (nyoj 303)

    相似与27进制的转换 #include<iostream> #include<cstdio> #include<cstring> #include<strin ...

  7. [河南省ACM省赛-第四届] 表达式求值(nyoj 305)

    栈的模拟应用: #include<iostream> #include<cstdio> #include<cstring> #include<string&g ...

  8. Mine Number(搜索,暴力) ACM省赛第三届 G

    Mine Number Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 Every one once played the gam ...

  9. NYOJ-171 聪明的kk 填表法 普通dp

    题目链接: http://acm.nyist.edu.cn/JudgeOnline/problem.php?pid=171 聪明的kk 时间限制:1000 ms  |  内存限制:65535 KB 难 ...

随机推荐

  1. javascript full screen 全屏显示 页面元素

    javascript full screen 全屏显示 页面元素 要想让页面的某个元素全屏显示,就像在网页上看视频的时候,可以全屏观看一样,该怎么实现呢? 一种最简单的方式,就是动态改变你想要全屏显示 ...

  2. cocos2dx android lua文件设置问题

    cocos2d-x版本: cocos2d-2.1rc0-x-2.1.2 通常我们在文件AppDelegate.cpp的applicationDidFinishLaunching()函数中设置lua代码 ...

  3. Organic Solar Cells - Generations of Solar Cells

    Sunlight --> Electricity A. E. Becquerel, 1839 . He stated that we can get energy from sunlight. ...

  4. 迷你MVVM框架 avalonjs 0.82发布

    迷你MVVM框架 avalonjs 0.82发布 本版本最大的改进是启用全新的parser. parser是用于干什么的?在视图中,我们通过绑定属性实现双向绑定,比如ms-text="fir ...

  5. Chrome浏览器网页截全屏算法以及实现

    做个一个简单的批量下载插件叫“挖一下”, 正如插件的名字一样,采集网页里面的所有图片,根据筛选条件过滤不需要的图片,最后下载选中的图片. 索性把网页也一起给截了,截屏分两种: 1.可见内容截屏 2.完 ...

  6. 权限开发 spring security 3.0.7 序列1 数据库脚本

    spring  security  3 细粒度权限控制第一篇,关于权限的初始化测试数据库脚本. 空间脚本: drop user FrameworkTest cascade; drop tablespa ...

  7. android电源“有毒”移动电源Android版的设计及其实现

    工作之余抽点时间出来写写博文,希望对新接触的朋友有帮助.今天在这里和大家一起学习一下android电源 报道http://www.cnbeta.com/articles/239726.htm称:安全研 ...

  8. python基础语言以及if/while语句结构

    接下来学会了变量:用简单的变量来代替复杂的字符串 变量首字母不能是数字或者特殊符号~!@#¥等. 字符集的发展: ASCII 255个 1个占1bytes------>1980年 GB2312 ...

  9. Spring实战——通过Java代码装配bean

    上篇说的是无需半行xml配置完成bean的自动化注入.这篇仍然不要任何xml配置,通过Java代码也能达到同样的效果. 这么说,是要把上篇的料拿出来再煮一遍? 当然不是,上篇我们几乎都在用注解的方式如 ...

  10. javascript提高篇+吐槽

    开篇吐槽 最近一直在投简历找工作,对于博主这样的屌丝应届生来说,一没过硬的技术,二没经验,三没高学历,四没炫酷的项目,五还没漂亮的简历,简直就是3无产品+2b青年.所以快1个月了投的简历没有收到一个面 ...