当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2779:Party Party Party

题目描述
Emma has just graduated high school and it is the custom for the new graduates to throw parties for themselves and invite everyone in school to attend. Naturally, Emma wishes to attend as many parties as possible. This is not such a problem on a weekday since usually there are only two or three parties in the evening. But, Saturdays are packed! Typically some parties start at 8 AM (breakfast is served) while others might end at midnight (much to the annoyance of the neighbors). Emma naturally wants to know how many parties she can attend.

Each party has a starting and stopping time, which are on the hour. These are listed via a 24-hour clock. For example, a party might start at 10 AM (10) and end at 2 PM (14). The earliest a party can start is 8 AM (8) and the latest it can end is midnight (24). In order not to be rude, Emma stays at each party at least one half hour and will consider traveling time between parties to be instantaneous. If there are times during the day when there are no parties to attend, she'll simply go home and rest.
输入解释
There will be multiple test cases. Each test case starts with a line containing an integer p (<=100) indicating the number of parties on the given day. (A value of p = 0 indicates end of input.) The following p lines are each of the form s e , both integers where 8<=s < e<=24 , indicating a party that starts at time s and ends at time e . Note there may be multiple parties with the same starting and ending time.
输出解释
For each input set output a line of the form

On day d Emma can attend as many as n parties.

where you determine the value of n and d is the number of the test case starting at 1.
输入样例
8 
12 13 
13 14 
12 13 
9 10 
9 10 
12 13 
12 14 
9 11 
3 
14 15 
14 15 
14 15 
0
输出样例
On day 1 Emma can attend as many as 7 parties. 
On day 2 Emma can attend as many as 2 parties.
来自杭电HDUOJ的附加信息
Recommend lcy

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-2779

最后修改于 2020-10-25T22:56:41+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)