[河南省ACM省赛-第三届] 聪明的kk (nyoj 171)
题目链接: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)的更多相关文章
- [河南省ACM省赛-第三届] 房间安排 (nyoj 168)
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=168 分析:找到一天中需要最多的房间即可 #include<iostream> ...
- [河南省ACM省赛-第三届] AMAZING AUCTION (nyoj 251)
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=251 规则: 1.若某竞标价唯一,则胜出 2.若不存在唯一竞标价,则投标次数最少竞标价中标 ...
- [河南省ACM省赛-第三届] BUYING FEED (nyoj 248)
#include<iostream> #include<cstdio> #include<algorithm> #include<cstring> us ...
- [河南省ACM省赛-第三届] 网络的可靠性 (nyoj 170)
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=170 根据题意,需要找到度数为1的结点个数,如下图: #include<iostre ...
- [河南省ACM省赛-第三届] 素数 (nyoj 169)
#include <iostream> #include <cstdio> #include <queue> #include <cstring> #i ...
- [河南省ACM省赛-第四届] 序号互换 (nyoj 303)
相似与27进制的转换 #include<iostream> #include<cstdio> #include<cstring> #include<strin ...
- [河南省ACM省赛-第四届] 表达式求值(nyoj 305)
栈的模拟应用: #include<iostream> #include<cstdio> #include<cstring> #include<string&g ...
- Mine Number(搜索,暴力) ACM省赛第三届 G
Mine Number Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^ 题目描述 Every one once played the gam ...
- NYOJ-171 聪明的kk 填表法 普通dp
题目链接: http://acm.nyist.edu.cn/JudgeOnline/problem.php?pid=171 聪明的kk 时间限制:1000 ms | 内存限制:65535 KB 难 ...
随机推荐
- PL/SQL Developer实现双击table表名查询
双击table默认为Expand/Collapse 展开/折叠 有时需快速查看该表数据,如果写select * from tab会显得麻烦, 我们可实现双击table来进行快速查询 方法为:Tools ...
- WebApp之PC客户端
开发WebApp之PC客户端 HTML5的跨平台性还是很好的,苹果.Android手机都可以用,所在最近使用Jquery Mobile开发了一个手机端应用程序,一次开发,多个平台使用. 但我们的很多客 ...
- 我的Pandas应用场景(2)
上文交代了一些啰嗦事,本文开始,就要来点实际的了. 先来一个比较简单的场景: Given:一个包括N(极其复杂,这里取3个)个列的DataFrame:df,df包括index: And:对df所有列元 ...
- centos安装svn
原文链接:http://blog.csdn.net/liuyuan_jq/article/details/2110814 1.SVN简介由于前些年在版本的管理上采用的都是CVS系统,总体上而言还是很优 ...
- MVVM与Knockout
MVVM与Knockout 前言 今天搞的有点快,因为上午简单研究了下MVC,发现MVC不太适合前端开发,然后之前看几位前端前辈都推荐前端使用MVVM,但是我对其还不甚了解,所以我觉得下午还是应该先看 ...
- How to deploy openbr on linux server very shorly---- linuxmint13/ubuntu12.04 AMD64/debian7
SO FAST ON A SERVER!!!! There are serveral packages that you have to install: 1. openbr 0.6.0 packag ...
- Ubuntu下OpenVPN客户端配置教程
一般来说,提供Web服务的Linux服务器是很少需要连接OpenVPN的,但是个人Linux计算机在很多时候就需要连接OpenVPN了.比如以Linux为开发环境,需要连接公司的OpenVPN等等. ...
- iOS开发-OC语言 (四)数组
知识点 1.NSArray 2.NSMutableArray 1.数组的基本用法: 2.数组的遍历 3.数组排序 =========== NSArray 不可变数组 ============= ...
- 你确实应该学习并使用的 10 个 C# 特性
1) async / await 使用 async / await 模式,可以在执行代码块操作的时候不会阻塞 UI 或者当前的线程.即使该操作被某些执行动作延迟了(比如一个 web 请求),async ...
- 浅谈JAVA中字符串常量的储存位置
在讲述这些之前我们需要一些预备知识: java中的内存被分成以下部分: 1.栈区:由编译器自动分配释放,具体方法执行结束后,系统自动释放JVM内存资源. 其作用有保存局部变量的值,包括:1.用来保存基 ...