HDOJ1050
Moving Tables
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 16129 Accepted Submission(s): 5542

The floor has 200 rooms each on the north side and south side along the corridor. Recently the Company made a plan to reform its system. The reform includes moving a lot of tables between rooms. Because the corridor is narrow and all the tables are big, only one table can pass through the corridor. Some plan is needed to make the moving efficient. The manager figured out the following plan: Moving a table from a room to another room can be done within 10 minutes. When moving a table from room i to room j, the part of the corridor between the front of room i and the front of room j is used. So, during each 10 minutes, several moving between two rooms not sharing the same part of the corridor will be done simultaneously. To make it clear the manager illustrated the possible cases and impossible cases of simultaneous moving.

For each room, at most one table will be either moved in or moved out. Now, the manager seeks out a method to minimize the time to move all the tables. Your job is to write a program to solve the manager’s problem.
3 4 10 20 30 40 50 60 70 80 2 1 3 2 200 3 10 100 20 80 30 50
10 20 30
这道题目很有意思!所以拿上来了!
贴代码说明自己太懒了!
别人的思路!
其实重合线段最多的一部分就是答案!这个仔细想想!
因为重合多的地方一定要分开弄!
注意:房间一侧都是隔着1个数!
所以还要预处理下!
主要代码:
HDOJ1050的更多相关文章
- hdoj1050 Moving Tables(贪心)
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=1050 题意 有一条走廊,走廊两边各有200个房间,一边的房间编号是奇数,另一边是偶数.现在有n个箱子需 ...
随机推荐
- 倒水问题 (codevs 1226) 题解
[问题描述] 有两个无刻度标志的水壶,分别可装x升和y升 ( x,y 为整数且均不大于100)的水.设另有一水缸,可用来向水壶灌水或接从水壶中倒出的水, 两水壶间,水也可以相互倾倒.已知x升壶为空壶, ...
- DIV指令一般用法
本文最初发表于2015-8-14,是由别的地方迁移过来的 (本文所讲为无符号运算) DIV指令是8086汇编中的除法运算指令,它的结果不是浮点数,而是两个整数:商和余数. 我们来看王爽老师是怎么讲的: ...
- Java通过SpyMemcached来缓存数据
配置好Magent+memcached后,很明显数据之间的输入与输出都是通过代理服务器的,magent是做代理服务器的很明显java在memecached的调用驱动在magent同样适用. 这里选择S ...
- Node.js中的模块化
每天一篇文章来记录记录自己的成长吧.大二,该静心了.加油~ 好了,废话不多说,今天说说nodejs中的模块化.(注:此文为自己对书nodejs实战的总结) nodejs一个重要的特性就是模块化,模块就 ...
- JS跨域方法及原理
JS跨域分析判断 JS跨域:在不同域之间,JS进行数据传输或通信.比如ajax向不同的域请求数据.JS获取iframe中的页面中的值(iframe内外不同域) 只要协议.端口.域名有一个不同则 ...
- scjp考试准备 - 1 - 循环控制
判断如下代码最后的执行结果. public class Breaker{ static String o = ""; public static void main(String[ ...
- find用法
find - 递归地在层次目录中处理文件 总 find [path...] [expression] 描 这个文档是GNU版本 find 命令的使用手册. find 搜索目录树上的每一个文件名,它从左 ...
- Android编程: ViewPager和Dialogs组件
学习内容:ViewPager和Dialogs组件 ====ViewPager组件==== 它的作用主要是支持屏幕左右滑动切换列表元素,使用方式如下: 1.首先定义ID号信息,创建res/values/ ...
- MYSQL 一些用法
LOAD DATA LOCAL INFILE 'C:/xampp/htdocs/test/file/sample.csv' INTO TABLE sample1 FIELDS TERMINATED B ...
- 62.在cdc文件上某些例化模块看不到的原因
比如在顶层文件中,例化了几个模块,综合后打开cdc文件,会在structure/net中少几个例化模块,即看不到,但在顶层文件中还是存在的,只是ISE软件综合的问题而已,原因是在顶层或子模块中,有些应 ...