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

建议使用的浏览器:

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

2424:Flo's Restaurant

题目描述
Sick and tired of pushing paper in the dreary bleary-eyed world of finance, Flo ditched her desk job and built her own restaurant.

In the small restaurant, there are several two-seat tables, four-seat tables and six-seat tables. A single diner or a group of two diners should be arranged to a two-seat table, a group of three or four diners should be arranged to a four-seat table, and a group of five or six diners should be arranged to a six-seat table.

Flo's restaurant serves delicious food, and many people like to eat here. Every day when lunch time comes, the restaurant is usually full of diners. If there is no suitable table for a new coming group of diners, they have to wait until some suitable table is free and there isn't an earlier arrival group waiting for the same kind of tables. Kind Flo will tell them how long they will get their seat, and if it's longer than half an hour, they will leave for another restaurant.

Now given the list of coming diners in a day, please calculate how many diners take their food in Flo's restaurant. You may assume it takes half an hour for every diner from taking a seat to leaving the restaurant.
输入解释
There are several test cases. The first line of each case contains there positive integers separated by blanks, A, B and C (A, B, C >0, A + B + C <= 100), which are the number of two-seat tables, the number of four-seat tables and the number of six-seat tables respectively. From the second line, there is a list of coming groups of diners, each line of which contains two integers, T and N (0 < N <= 6), representing the arrival time and the number of diners of each group. The arrival time T is denoted by HH:MM, and fixed between 08:00 and 22:00 (the restaurant closes at 23:00). The list is sorted by the arrival time of each group in an ascending order, and you may assume that no groups arrive at the same time. Each test case is ended by a line of "#".

A test case with A = B = C = 0 ends the input, and should not be processed.
输出解释
For each test case, you should output an integer, the total number of diners who take their food in Flo's restaurant, in a separated line.
输入样例
1 1 1
10:40 1
10:50 2
11:00 4
#
1 1 1
10:40 1
10:50 2
11:00 2
#
1 2 1
10:30 1
10:40 3
10:50 2
11:00 1
11:20 5
#
0 0 0
输出样例
7
3
12

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 PKU Monthly,Alcyone

源链接: POJ-2424

最后修改于 2020-10-29T06:32:11+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536