poj 2726 Holiday Hotel (排序&&单调栈)

这篇博客介绍了如何使用排序和单调栈解决ACM题目POJ 2726 Holiday Hotel。内容涉及输入输出格式、样例分析,主要讨论如何找到距离海岸线M距离范围内最便宜的酒店。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Holiday Hotel
Time Limit: 2000MS   Memory Limit: 65536K
Total Submissions: 8098   Accepted: 3176

Description

Mr. and Mrs. Smith are going to the seaside for their holiday. Before they start off, they need to choose a hotel. They got a list of hotels from the Internet, and want to choose some candidate hotels which are cheap and close to the seashore. A candidate hotel M meets two requirements: 
  1. Any hotel which is closer to the seashore than M will be more expensive than M. 
  2. Any hotel which is cheaper than M will be farther away from the seashore than M.

Input

There are several test cases. The first line of each test case is an integer N (1 <= N <= 10000), which is the number of hotels. Each of the following N lines describes a hotel, containing two integers D and C (1 <= D, C <= 10000). D means the distance from
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值