程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程解疑 >> it-Resource Allocation

it-Resource Allocation

編輯:編程解疑
Resource Allocation

問題描述 :

HDU-Sailormoon is made up of three girls~~~wj, xq, lff, usually they work together —- solve a variety of problems. So they has to use some resources in the process.
In order to make it more convenient, they will put some resources in a box big enough, each resource has its ID and level of priority. When they want a kind of resources, they will give its ID and get it from the box. If there are several ones available in the box, they will get the highest priority ones. If there are still several ones available, they will get the one which puts in the box first.
輸入:

The input will consist of several cases, please deal with till the end of file. Each case contains a integer N(0<N<=10000), representing there are N steps following. For example, if input is "R x y"(x, y are integers,0<=x,y<=10000), representing they put a resource to the box, its ID is x, and its priority is y(the higher the priority is, the smaller the y is). If input is "name r" (name may be "wj" or "xq" or "lff", r is an integer,0<=r<=10000), representing one girl called "name" wants a resource, which ID is r.
輸出:

The input will consist of several cases, please deal with till the end of file. Each case contains a integer N(0<N<=10000), representing there are N steps following. For example, if input is "R x y"(x, y are integers,0<=x,y<=10000), representing they put a resource to the box, its ID is x, and its priority is y(the higher the priority is, the smaller the y is). If input is "name r" (name may be "wj" or "xq" or "lff", r is an integer,0<=r<=10000), representing one girl called "name" wants a resource, which ID is r.
樣例輸入:

9
R 1 5
R 2 3
R 1 5
R 2 0
wj 1
xq 2
lff 3
lff 2
xq 2
樣例輸出:

wj gets Num 1: 1 5!
xq gets Num 4: 2 0!
No one fits!
lff gets Num 2: 2 3!
No one fits!

最佳回答:


http://www.acmerblog.com/hdu-3288-resource-allocation-5183.html

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved