编程介的小学生 2017-05-10 02:05 采纳率: 20.5%
浏览 793
已采纳

Auctions R Us

Having run into trouble with current online auctions and buyers that win auctions and then back out, you decide to open a new enterprise that has the bidders deposit funds before they may bid onany item. If they win an auction, the amount they bid is immediately (that second!) deducted from their account. (The problem of sellers that don't deliver the items will be left for another day.)

You must write a program to implement the rules of this auction. You will be auctioning off a number of items, each of which will have a reserve price that must be met. Each of your bidders will deposit funds with you, and you must match these funds with items they successfully bid for.You will write a program that tracks the auctions during a single day and outputs the results ofeach auction.

Auction Rules

You are guaranteed:

No two items will have the same end time.
No two bids will have the same bid time.
No price, bid, or account balance will be negative.
Bidder numbers and item numbers are unique within each category, but a bidder may have the same number as an item. Bidder and item numbers are not necessarily assigned sequentially.

An auction is won by the highest bid that:

arrives no later than the second the auction ends.
is greater than or equal to the minimum price for the item
has at least the bid amount remaining in the bidder's account at the instant the auction ends.

Input

There are 3 sections in the data file, describing the items available for bid, the registered bidders, and the bids made during the auction.

Items

A single line containing the number of items, i
i lines, one for each item of the form:

Item number is a non-negative integer, minimum price is specified to the penny (0.01), and auction end time is in 24 hour format of the form XX:YY:ZZ where XX is in hours from 00 to 23, YY is in minutes from 00 to 59, and ZZ is in seconds from 00 to 59.
Bidders

A single line with the number of bidders registered, j
j lines of bidder data of the form:

Where bidder number is a non-negative integer and account balance is specified to the penny (0.01).
Bids

A single line with the number of bids received, k
k lines of bid data of the form:

where all fields are formatted as described above.

Output

Output one line for each item being auctioned, in order of their auction finish time, listing

Item Bidder Price

If there is not a winning bid for an item, for that item output

Item Reserve not met.

Sample Input

2
1 5.00 05:06:27
2 25.00 15:30:11
2
11 37.37
22 55.55
3
1 11 60.00 04:03:01
2 11 26.00 00:18:03
2 22 27.00 09:03:05

Sample Output

Item 1 Reserve not met.
Item 2 Bidder 22 Price 27.00

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-05-26 15:49
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来