题目链接: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. ios学习之常见问题记录

    使用Core Data的好处和缺点? 首先这是apple官方极力推荐的,使用它而不是SQLite.好处有大概这么几点:1.减少你model层的代码量,减少50%-70%.无需测试和优化.2.提供了内存 ...

  2. mac在线恢复教程

    上个周,我本来想升级一下Xcode,可是我的系统是10.8de,xcode5.0.1 最低支持10.8.4 所以就想升级一下我的mac的系统,可是因为我的appstore 是从别人的电脑上考过来的,要 ...

  3. oracle中sys和System的默认密码

    sys:change_on_install system:oracle 如果用pl/sql登录的话,记得在下面用户权限选项选择sysdba,如图所示:

  4. C++内存中的封装、继承、多态(上)

    C++内存中的封装.继承.多态(上) 继我的上一篇文章:浅谈学习C++时用到的[封装继承多态]三个概念 此篇我们从C++对象内存布局和构造过程来具体分析C++中的封装.继承.多态. 一.封装模型的内存 ...

  5. C#多线程解决界面卡死问题

    C#多线程解决界面卡死问题的完美解决方案 文章下最方有源码下载 问题描述:当我们的界面需要在程序运行中不断更新数据时, 当一个textbox的数据需要变化时, 对于这个问题可以先参考下我的另外一个文章 ...

  6. GetWindowRect和GetClientRect的区别详解

    一:关于坐标 MFC中绘图时经常涉及到坐标计算,GetWindowRect和GetClientRect这两个函数,是获取逻辑坐标系中窗口或控件(其实也是窗口)大小和坐标的常用函数了,有什么不一样的? ...

  7. jquery跨域请求数据

    jquery跨域请求数据 jquery跨越请求数据.实际开发中经常会碰到两个网站数据交互问题,当向另一个站点请求数据该如何做? 实际上非常容易,请按照下面的步骤做: 第一:编写js,通过get获取远程 ...

  8. java.lang.IllegalArgumentException: Wrong FS ...异常的解决

    配置完Hbase后,启动,JPS发现少了HMaster这个进程.查看了一下日志如下: java.lang.IllegalArgumentException: Wrong FS: hdfs://192. ...

  9. codeforces 6A. Triangle

    A. Triangle time limit per test 2 seconds memory limit per test 64 megabytes input standard input ou ...

  10. 链方法[C# 基础知识系列]专题三:如何用委托包装多个方法——委托链

    最近研究链方法,稍微总结一下,以后继续补充: 弁言: 上一专题分析了下编译器是如何来翻译委托的,从中间语言的角度去看委托,希望可以帮助大家进一步的理解委托,然而之前的分析都是委托只是封装一个方法,那委 ...