C语言实现双队列问题,怎么做的?

Problem Description
The new founded Balkan Investment Group Bank (BIG-Bank) opened a new office in Bucharest, equipped with a modern computing environment provided by IBM Romania, and using modern information technologies. As usual, each client of the bank is identified by a positive integer K and, upon arriving to the bank for some services, he or she receives a positive integer priority P. One of the inventions of the young managers of the bank shocked the software engineer of the serving system. They proposed to break the tradition by sometimes calling the serving desk with the lowest priority instead of that with the highest priority. Thus, the system will receive the following types of request:

Your task is to help the software engineer of the bank by writing a program to implement the requested serving policy.

Input
Each line of the input contains one of the possible requests; only the last line contains the stop-request (code 0). You may assume that when there is a request to include a new client in the list (code 1), there is no other request in the list of the same client or with the same priority. An identifier K is always less than 106, and a priority P is less than 107. The client may arrive for being served multiple times, and each time may obtain a different priority.

Output
For each request with code 2 or 3, the program has to print, in a separate line of the standard output, the identifier of the served client. If the request arrives when the waiting list is empty, then the program prints zero (0) to the output.

Sample Input
2
1 20 14
1 30 3
2
1 10 99
3
2
2
0

Sample Output
0
20
30
10
0

as ibm c

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!

相似问题

0
双队列实现堆栈方面的一个问题,这里的队列是优先级队列的话怎么实现,C语言谢谢
0
使用循环链表实现一个双向队列并且实现出队列和进队列的编程算法, 使用C语言的编程?
0
双队列+停止请求编码的问题,如何利用C语言技术的形式的实现
1
素数的队列的计算问题的算法,采用C语言的编程计算实现它
0
循环队列在旋转数组上的运用问题,怎么利用C语言的程序的设计的技术实现
0
队列的方式解决这里的桌子排序的问题怎么实现,运用的C程序的语言设计的技术的方式?
0
循环队列的数数的问题,怎么采用C语言代码程序编写的过程去实现程序的编制
0
数据结构队列问题的综合的运用计算,怎么采用C语言的程序设计的方法来编写的代码实现算法的求解?
0
双倍的队列的问题,这种数据结构的程序用C语言的代码如何才能正确地实现的呢?
0
尽可能多的元素插入双端队列的方法,怎么用 C 语言的编写出的程序代码的方式有效地实现这个方法
1
求一个代码c语言实现图的深度遍历(递归)、非递归算法以及实现图的广度遍历(队列)
0
牛的排序的队列的问题,怎么使用C语言的程序的编写的代码的形式的具体的代码去实现
0
构造队列的一个算法的问题,怎么采用C语言的程序的设计的编写的过程的技术实现的
1
我想用C语言来写一个简单的链式队列,但是一直报错
0
Double Queue 双队列问题
1
如何用程序表达购票这个队列?
2
用栈实现社团管理,要求如下,怎么做?
2
线性表及栈与队列的实现 -- 栈
1
(修改报错的程序)线性表及栈与队列的实现 -- 栈
1
创建一个字符循环队列,实现字符元素入队列、出队列、显示队列元素等操作。要求为用户提供选择式菜单?