luogu1353 Running
dp[i][j]表示走i分钟疲劳值为j时的最远距离
然后搞一下就好啦
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <stack>
#define ll long long
#define inf (-1u>>1)
using namespace std;
inline int read()
{
int ans=,f=;
char ch=getchar();
while(!isdigit(ch)){if(ch=='-')f=-f;ch=getchar();}
while(isdigit(ch)){ans=*ans+ch-'';ch=getchar();}
return ans*f;
}
int d[];
int f[][];
int main()
{
int n,m;
n=read();m=read();
for(int i=;i<=n;i++)d[i]=read();
for(int i=;i<=n;i++)
{
for(int j=;j<=m;j++)
{
if(j>)f[i][j]=max(f[i][j],f[i-][j-]+d[i]);
if(i>=j)
{
f[i][]=max(f[i-j][j],f[i][]);
f[i][]=max(f[i-][],f[i][]);
}
}
}
cout<<f[n][];
return ;
}
另:一天10000分钟 这牛怕是叫□-□
luogu1353 Running的更多相关文章
- Crystal Clear Applied: The Seven Properties of Running an Agile Project (转载)
作者Alistair Cockburn, Crystal Clear的7个成功要素,写得挺好. 敏捷方法的关注点,大家可以参考,太激动所以转载了. 原文:http://www.informit.com ...
- Running Dubbo On Spring Boot
Dubbo(http://dubbo.io/) 是阿里的开源的一款分布式服务框架.而Spring Boot则是Spring社区这两年致力于打造的简化Java配置的微服务框架. 利用他们各自优势,配置到 ...
- Android PopupWindow Dialog 关于 is your activity running 崩溃详解
Android PopupWindow Dialog 关于 is your activity running 崩溃详解 [TOC] 起因 对于 PopupWindow Dialog 需要 Activi ...
- IntelliJ运行下载的Servlet时报错 Error running Tomcat 8.5.8: Unable to open debugger port (127.0.0.1:49551): java.net.SocketException
学习Java Servlet时,从Wrox上下载了示例代码,准备run/debug时发现以下错误: Error running Tomcat 8.5.8: Unable to open debugge ...
- teamviewer "TeamViewer Daemon is not running
执行下面的命令问题解决: # teamviewer --daemon enable enable Sat Jan :: CST Action: Installing daemon () for 'up ...
- mysql 有报错 ERROR! MySQL is not running, but lock file (/var/lock/subsys/mysql) exists
sh-4.1# /etc/init.d/mysqld status ERROR! MySQL is not running, but lock file (/var/lock/subsys/mysql ...
- Errors occurred during the build. Errors running builder 'JavaScript Validator' on project
1.问题:Errors occurred during the build. Errors running builder 'JavaScript Validator' on project 2.解决 ...
- The network bridge on device VMnet0 is not running
The network bridge on device VMnet0 is not running. The virtual machine will not be able to communic ...
- ERROR! MySQL is running but PID file could not be found
/etc/init.d/mysql status提示ERROR! MySQL is running but PID file could not be found先打印MYSQL进程ps aux | ...
随机推荐
- Laravel开发:Laravel核心——Ioc服务容器
服务容器 在说 Ioc 容器之前,我们需要了解什么是 Ioc 容器. Laravel 服务容器是一个用于管理类依赖和执行依赖注入的强大工具. 在理解这句话之前,我们需要先了解一下服务容器的来龙去脉: ...
- GUN C中的错误报告
在C语言中,很多库函数在调用失败时都会返回特定的值.比如返回-1,空指针,EOF等.但是这些值仅仅表示的调用失败,并未给出详细的错误信息.如果想查看详细的错误内容,就要去查看errno的错误代码,er ...
- iOS开发 剖析网易新闻标签栏视图切换(addChildViewController属性介绍)
本文转载至 http://www.tuicool.com/articles/3ymMzub CSDN博客原文 http://blog.csdn.net/hmt20130412/article/det ...
- fedora找开ftpd服务器并以root登陆
工作原因需要在federal中弄个vsftpd再用root去登陆(我知道这样不太安全) 确认系统的版本 [root@localhost ~]# uname -a Linux localhost.loc ...
- 核函数 深度学习 统计学习 强化学习 神经网络 xx
- word2vec_basic.py
ssh://sci@192.168.67.128:22/usr/bin/python3 -u /home/win_pymine_clean/feature_wifi/word2vec_basic.py ...
- 7 Javascript:表单与验证-非空验证
表单提交前要检查数据的合法性 在要对表单里的数据进行验证的时候,能够利用getElementById()来訪问网页上不论什么一个元素 每一个表单域都有一个form对象,可被传给不论什么验证表单数据的函 ...
- leetcode第一刷_Best Time to Buy and Sell Stock II
这道题尽管是上一道题的增强.可是反而简单了. 能够交易无数次,可是买卖必须成对的出现. 为了简单起见.我用abc三股股票来说明,且忽略掉相等的情况.三个数一共同拥有六种大小关系.注意他们之间的先后顺序 ...
- 程序运行之ELF文件的段
我们将之前的代码增加下变量来具体看下 在代码中增加了全局变量以及静态变量,还有一个简单的函数. #include <stdio.h> int global_var=1; int globa ...
- jauery table
$("#tableData tr:gt(0)").each(function() { }//橘色部分是查找id为tableData的DataTable里面除第一行以外的行