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个箱子需 ... 
随机推荐
- 学习simple.data之高级篇
			一.调用存储过程 1.不带参数 CREATE PROCEDURE ProcedureWithoutParams AS SELECT * FROM ORDER; 调用db.ProcedureWithou ... 
- WIN8+VS2013编写发布WCF之二(部署)
			上文简介了如何建立WCF工程并且调试,下面说一下如何部署. 本文将陆陆续续讲述三种部署方式,随着项目的进展将不断补全. 声明: 用管理员身份打开VS2013,发布前请将程序的.net版本改成与服务器相 ... 
- 访问svc 文件,编译器错误消息: CS0016,未能写入输出文件
			编译错误 说明: 在编译向该请求提供服务所需资源的过程中出现错误.请检查下列特定错误详细信息并适当地修改源代码. 编译器错误消息: CS0016: 未 ... 
- linux的一点小随笔
			随意写的一些东西,也就为以后自己可能看看... 1.vim安装,sudo apt-get install vim-gtk,于是vim就安装好了.当然在我电脑上还出现了gvim,简单的vim配置(etc ... 
- 实战Django:官方实例Part3
			前面两个部分我们介绍了投票应用的框架和后台管理部分.接下来舍得要介绍这个应用面向用户的界面. 这里我们要引入一个新的概念,"视图".在Django中,视图是一根连接模型和模板的纽带 ... 
- 浅谈objective—C管理内存
			这段时间被导师催着论文,调试各种BUg,也是醉了,发现很大程度上,内存出错,栈溢出,各种悲剧.那么今天就和大家一起对OC的内存管理来个探微吧.Objective-C使用一个保留计数记录了我们所创建的所 ... 
- PBOC规范(2.0->3.0)对照表
			1 数据方面 TAG PBOC2.0 ... 
- DB2数据库之间联邦
			现在有以下两个数据库:sample,QIN 需要在数据库QIN中访问sample中的表ACT 1.数据库编目 C:\Users\QIN>db2 catalog tcpip node OLIVER ... 
- Socket(1)
			端口号可以从0~65535: 今天就写TCP相关.在下一节我会分别写有关UDP,还有MultiCastSocket. Socket的工作原理: 通信两端都建立一个Socket,从而两端形成虚拟链路.通 ... 
- android开发系列之多线程
			今天在这篇博客里面,我只想谈谈自己对程序开发里面避无可避的一个问题-多线程的一些看法与思考. 其实说到多线程这个名称相信只要接触过软件这个行业的人都已经耳熟能详了,但是如果被问到到底什么才是多线程呢? ... 
