1014 Waiting in Line】的更多相关文章

PAT甲级1014. Waiting in Line 题意: 假设银行有N个窗口可以开放服务.窗前有一条黄线,将等候区分为两部分.客户要排队的规则是: 每个窗口前面的黄线内的空间足以包含与M个客户的一条线.因此,当所有N行都满时, 所有的客户(和包括)(NM + 1)第一个将不得不等待在黄线后面的一行. 每个客户将选择最短的行,以便在穿过黄线时等待.如果长度相同的两行以上,客户将始终选择数字最小的窗口. 客户[i]将在T [i]分钟内处理他/她的交易. 前N名客户被假定在上午8:00送达. 现在…
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…
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…
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…
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…
题目:https://www.patest.cn/contests/pat-a-practise/1014 思路: 直接模拟类的题. 线内的各个窗口各为一个队,线外的为一个,按时间模拟出队.入队. 注意点:即使到关门时间,已经在服务中的客户(窗口第一个,接待时间早于关门时间)还是可以被服务的.其它的则不服务. #include<iostream> #include<vector> #include<set> #include<map> #include<…
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…
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…
problem 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 wi…
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…
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…
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…
题目 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…
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…
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.这句话的意思就是:对于那…
题意:n个窗口,每个窗口可以排m人.有k为顾客需要办理业务,给出了每个客户的办理业务时间.银行在8点开始服务,如果窗口都排满了,客户就得在黄线外等候.如果有一个窗口用户服务结束,黄线外的客户就进来一个.如果有多个可选,选窗口id最小的.输出查询客户的服务结束时间. 如果客户在17点(注意是包括的!!!就在这里被坑了,一开始还以为不包括...)或者以后还没开始服务,就输出Sorry如果已经开始了,无论多长都会继续服务的. 思路:建立一个优先级队列,存储在黄线之内的所有客户.对于m*n之前的人,依此…
简单模拟题,注意读懂题意就行 #include <iostream> #include <queue> using namespace std; #define CUSTOMER_MAX 1000+1 #define INF 0x6fffffff #ifndef LOCAL // #define LOCAL #endif LOCAL int n; // number of windows <=20 int m ;// queue capacity <=10 int k;…
简单模拟题. #include<iostream> #include<cstring> #include<cmath> #include<algorithm> #include<cstdio> #include<map> #include<queue> using namespace std; struct X { int st; int len; int en; }p[]; queue<]; int n,m,k,s…
这题写了有一点时间,最开始想着优化一下时间,用优先队列去做,但是发现有锅,因为忽略了队的长度. 然后思考过后,觉得用时间线来模拟最好做,先把窗口前的队列填满,这样保证了队列的长度是统一的,这样的话如果到某个时间,队首的人已经服务完了,这样这个队列的长度就减少一,这就变成了所有队列中长度最短的队列,所以直接向这个队列里面添加一个人就可以了. 按照从小到大轮询窗口的话,这样正好符合题中的要求,就是队列长度相同短,先选窗口序号小的窗口.如果按照这种策略,少一个就补一个的策略,队列长度会一直保持相等.…
题面: 输入四个正整数N,M,K,Q(N<=20,M<=10,K,Q<=1000),N为银行窗口数量,M为黄线内最大人数,K为需要服务的人数,Q为查询次数.输入K个正整数,分别代表每位顾客需要被服务的时间,Q次查询每次查询一位顾客被服务完离开银行的时间.如果他在五点以前(不包括五点)没有开始被服务,输出“Sorry”. trick: 在五点以前(不包括五点)没有开始被服务,输出“Sorry”,而不是被服务完时间在五点以后(以题面为准). AAAAAccepted code: #inclu…
//转自:https://blog.csdn.net/apie_czx/article/details/45537627 1014 Waiting in Line (30)(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…
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 is…
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…
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:220 解决:64 题目描述: 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 insid…
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…
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) 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…
题目: 1014. Waiting in Line (30) 时间限制 400 ms 内存限制 32000 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…
准备每天刷两题PAT真题.(一句话题解) 1001 A+B Format  模拟输出,注意格式 #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; string ans = ""; int main() { ; cin >> a >> b; c = a + b; ) {…