HDU 5477: A Sweet Journey
A Sweet Journey
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 25 Accepted Submission(s): 12
regain B point strengths per meter when riding. Master Di wonders:In the beginning, he needs to prepare how much minimum strengths. (Except riding all the time,Master Di has no other choice)

indicating the number of test cases.
For each test case:
The first line contains four integers, n, A, B, L.
Next n lines, each line contains two integers: Li,Ri,
which represents the interval [Li,Ri] is
swamp.
1≤n≤100,1≤L≤105,1≤A≤10,1≤B≤10,1≤Li<Ri≤L.
Make sure intervals are not overlapped which means Ri<Li+1 for
each i (1≤i<n).
Others are all flats except the swamps.
Please output “Case #k: answer”(without quotes) one line, where k means the case number counting from 1, and the answer is his minimum strengths in the beginning.
1
2 2 2 5
1 2
3 4
Case #1: 0
最近状态一直不怎么好,想了很多问题都没有想出答案。当然了,我这种状态好了也不会好到哪里去。。。
只能切一切这种菜题了。。。
题意就是一个人去旅行,有沼泽地有平坦地,平坦地可以涨力气,沼泽地耗力气。问如果能顺利到达目的地的话,一开始要准备多少力气。
代码:
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#pragma warning(disable:4996)
using namespace std; int dis[100005]; int main()
{
int test,i,j,n,A,B,L,temp1,temp2,ans;
scanf("%d",&test);
for(i=1;i<=test;i++)
{
memset(dis,0,sizeof(dis));
scanf("%d%d%d%d",&n,&A,&B,&L);
for(j=1;j<=n;j++)
{
scanf("%d%d",&temp1,&temp2);
dis[temp2]=(-1)*(temp2-temp1)*(A+B);
}
ans=0;
for(j=1;j<=L;j++)
{
dis[j]=dis[j-1]+dis[j]+B;
ans=min(ans,dis[j]);
}
printf("Case #%d: %d\n",i,-1*ans);
}
return 0;
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
HDU 5477: A Sweet Journey的更多相关文章
- HDU 5477 A Sweet Journey 水题
A Sweet Journey Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pi ...
- CodeForces 567B Berland National Library hdu-5477 A Sweet Journey
这类题一个操作增加多少,一个操作减少多少,求最少刚开始为多少,在中途不会出现负值,模拟一遍,用一个数记下最大的即可 #include<cstdio> #include<cstring ...
- 2015 ACM/ICPC Asia Regional Shanghai Online
1001 Puzzled Elena 1002 Antonidas 1003 Typewriter 1004 Count the Grid 1005 Code Formatting 1006 Ther ...
- HDU5477(模拟)
A Sweet Journey Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)T ...
- HDU 6042 - Journey with Knapsack | 2017 Multi-University Training Contest 1
/* HDU 6042 - Journey with Knapsack [ 生成函数,五边形定理 ] | 2017 Multi-University Training Contest 1 题意: n种 ...
- HDU 5025:Saving Tang Monk(BFS + 状压)
http://acm.hdu.edu.cn/showproblem.php?pid=5025 Saving Tang Monk Problem Description <Journey to ...
- hdu 5326 Work
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5326 Work Description It’s an interesting experience ...
- hdu 2822 Dogs
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=2822 Dogs Description Prairie dog comes again! Someda ...
- HDU 5584 LCM Walk 数学
LCM Walk Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5584 ...
随机推荐
- 禁用UpdateOrchestrator重新启动任务
LTSC2019 联网下载更新后,总是用户不使用电脑的时候重启更新系统. 搜索发现是计划任务中\Microsoft\Windows\UpdateOrachestrator重新任务的导致的. 查看这个任 ...
- LINQ -- 匿名类型
匿名类型注意事项: 匿名类型只能和局部变量配合使用,不能用于成员. 由于匿名类型没有名字,我们必须使用var关键字作为变量类型. 不能设置匿名类型对象的属性.编译器为匿名类型穿件的属性是只读的. 除了 ...
- 开发工具类(eclipse、安卓SDK) 镜像站
1.eclipse 中国科技大学:http://mirrors.ustc.edu.cn/eclipse/ 中国科学院:http://mirrors.opencas.cn/eclipse/ 东北大学:h ...
- kali 中文乱码解决方法
本文转自https://www.cnblogs.com/sym945/p/11943842.html#4449966 1.更换阿里源 vim /etc/apt/sources.list,编辑源之后,a ...
- zabbix agent的主动工作模式实战案例
zabbix agent的主动工作模式实战案例 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.zabbix agent的工作模式概述 zabbix agent的主动工作模式: ...
- 使用nginx做反向代理来访问tomcat服务器
本次记录的是使用nginx来做一个反向代理来访问tomcat服务器.简单的来说就是使用nginx做为一个中间件,来分发客户端的请求,将这些请求分发到对应的合适的服务器上来完成请求及响应. 第一步:安装 ...
- vue使用videojs控制后台m3u8数据请求
关于Video.js的使用方法就不再说了,有兴趣的请迁跃:https://videojs.com/ VideoJS中并没有stop之类控制后台数据请求的参数,只有暂停 video.pause()方法 ...
- JS+ES6 - 向数组的开头添加一个或更多元素
- stm32CubeMx CAN 发送数据
平台 STM32F429 软件 STM32CubeMx 5.0.0 固件库 STM32Cube_FW_F4_V1.23.0 目的: 实现 CAN 的发送 一 简介 CAN是控制器局域网络(Co ...
- java提升一:内部类
1.总体定义 定义在一个类中的类,就称之为内部类. 2.为什么要使用内部类 (1)使用匿名内部类,无需对只使用一次的接口实现类进行创建,方便了对于接口和抽象类的实现及其使用. (2)每个内部类都可以独 ...