当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

1490:Cabinets

题目描述
Well-Built Cabinet Distributors, Inc. recently received an electronic catalog of cabinets from their leading manufacturer, Woodcraft. Unfortunately, the format of the data is not consistent with that expected by Well-Built's inventory software. For this problem, you will construct a program that reformats the Woodcraft catalog for use by the inventory software.
输入解释
The input will contain multiple cases,each of them as described below.There is a blank line between two consecutive cases.
Input will be formatted as from a comma-delimited ASCII file. Your program must read all input from the standard input file. Each line in the input has a maximum length of 64 characters and contains the following fields:
Field         Length   Explanation

----------------------------------------------------------------------------
Style Code 1-3 Code specifying the cabinet's style.
Style Name 0-15 Name for cabinet style.
Description 1-15 Code describing type of cabinet.
Extension 0-25 Additional information about cabinet.
Unit Price 0-6 Manufacturer's suggested retail price (dollars x 100).

The records are presented in ascending order by Style Code. You may assume that all fields will be consistent with the lengths given, and that all fields will contain appropriate characters.
输出解释
Output will consist of a reformatted catalog. The reformatted catalog file will be a comma-delimited ASCII file. The first record in the file must be the following:
Item Id,Item Desc,Item Price
Each remaining record in the file will have a maximum length of 50 characters and contain the following fields:
Field         Length   Explanation

----------------------------------------------------------------------------
Item Id 4-13 Unique identification code for inventory database.
Item Desc 1-30 Inventory description of cabinet.
Item Price 4-7 Manufacturer's suggested retail price.

The Item Id is formed by concatenating the Style Code and the Description. If the Style Code is less than three characters long, it must be left-filled with zeros to three characters. If the Item Id exceeds 13 characters, then the record is rejected.

The Item Desc is formed by concatenating the Style Name, a hyphen, and the Extension. If the Style Name is missing, use the Style Name from the first record of the corresponding Style Code group. If this first record has no Style Name either, then reject the record. If the Extension is not present, then Item Desc is the same as Style Name (no hyphen). If Item Desc exceeds 30 characters, then it must be truncated on the right.

The Item Price is formed by formatting the Unit Price as dollars and cents. If Unit Price is not present, then Item Price = 0.00.
输入样例
23,CHAMPAGNE,BASE36,3" RECESSED TOE KICK,8900 
23,,BASE54,,11000
25,LAUREL,CNR24LT,,15000 
107,COLONIAL,BASE54WSIDEJAM
202,SAGEBRUSH,OVRHD54P,USE WITH HDWARE KIT #3207 
221,ALVEA MODERN,BASE36
221,ALVEA MODERN,OVRHD54WCAP
输出样例
Item Id,Item Desc,Item Price
023BASE36,CHAMPAGNE-3" RECESSED TOE KICK,89.00 
023BASE54,CHAMPAGNE,110.00 
025CNR24LT,LAUREL,150.00
202OVRHD54P,SAGEBRUSH-USE WITH HDWARE KIT ,0.00 
221BASE36,ALVEA MODERN,0.00

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-1490

最后修改于 2020-10-29T06:05:30+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 10000