PAT 1014 Waiting in Line (模拟)】的更多相关文章

Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules for the customers to wait in line are: The space inside the yellow line in front of each window is…
1014. Waiting in Line (30) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules for…
Suppose a bank has N windows open for service.  There is a yellow line in front of the windows which devides the waiting area into two parts.  The rules for the customers to wait in line are: The space inside the yellow line in front of each window i…
n个窗口就有n个队列,模拟这n个队列就可以了.需要注意的是,一个人在选择排队窗口的时候,他会选择排队人数最少的窗口,如果存在多个窗口排队的人数相同,那么他会选择编码最小的窗口. Note that since the bank is closed everyday after 17:00, for those customers who cannot be served before 17:00, you must output "Sorry" instead.这句话的意思就是:对于那…
这题写了有一点时间,最开始想着优化一下时间,用优先队列去做,但是发现有锅,因为忽略了队的长度. 然后思考过后,觉得用时间线来模拟最好做,先把窗口前的队列填满,这样保证了队列的长度是统一的,这样的话如果到某个时间,队首的人已经服务完了,这样这个队列的长度就减少一,这就变成了所有队列中长度最短的队列,所以直接向这个队列里面添加一个人就可以了. 按照从小到大轮询窗口的话,这样正好符合题中的要求,就是队列长度相同短,先选窗口序号小的窗口.如果按照这种策略,少一个就补一个的策略,队列长度会一直保持相等.…
1014 Waiting in Line (30 分)   Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules for the customers to wait in line are: The space inside the yellow li…
PAT甲级1014. Waiting in Line 题意: 假设银行有N个窗口可以开放服务.窗前有一条黄线,将等候区分为两部分.客户要排队的规则是: 每个窗口前面的黄线内的空间足以包含与M个客户的一条线.因此,当所有N行都满时, 所有的客户(和包括)(NM + 1)第一个将不得不等待在黄线后面的一行. 每个客户将选择最短的行,以便在穿过黄线时等待.如果长度相同的两行以上,客户将始终选择数字最小的窗口. 客户[i]将在T [i]分钟内处理他/她的交易. 前N名客户被假定在上午8:00送达. 现在…
1014 Waiting in Line (30分)   Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules for the customers to wait in line are: The space inside the yellow lin…
题目:https://www.patest.cn/contests/pat-a-practise/1014 思路: 直接模拟类的题. 线内的各个窗口各为一个队,线外的为一个,按时间模拟出队.入队. 注意点:即使到关门时间,已经在服务中的客户(窗口第一个,接待时间早于关门时间)还是可以被服务的.其它的则不服务. #include<iostream> #include<vector> #include<set> #include<map> #include<…
Waiting in Line Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules for the customers to wait in line are: The space inside the yellow line in front of…