21725_LIBRARYCODES

2022-5-16 18:20| 发布者: Hocassian| 查看: 19| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89505794172700-Problem List-采集的数据-后羿采集器.html

Pro.ID

21725

Title

LIBRARY CODES

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21725

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 1500/500 MS (Java/Others)     Memory Limit: 131072/65536 K (Java/Others)
  • 描述

    A local library is redoing its book labels with the Dewey Decimal classification. Where possible, labels are printed horizontally, but if they are too wide, they are printed vertically. A fixed pitch font is used, so all characters are the same width. To make the labels readable, a 1mm gap must be left before and after the number.
    Given the width of a book in mm, the width of a character of the font and the text of the label, it is easy to decide if the label could be displayed horizontally or if it would have to be displayed vertically.

    输入

    Input consists of data about a number of libraries. The final line contains # 0 (separated by a space) ? this line should not be processed.
    For a library, the first line of input will be the name of the library (up to 20 letters only, no spaces), followed by a single positive integer, f, which is the width in mm of a single character in the font used by the library. 1 < f < 8. The next line contains a single integer, c, the number of books to be processed. There then follows c lines, each containing data about 1 book. Each line contains a positive integer, w, the width of the book in mm (5 <= w <=50), and the text to be displayed on the label. The text will contain between 3 and 6 characters.

    输出

    Description
    A local library is redoing its book labels with the Dewey Decimal classification. Where possible, labels are printed horizontally, but if they are too wide, they are printed vertically. A fixed pitch font is used, so all characters are the same width. To make the labels readable, a 1mm gap must be left before and after the number.
    Given the width of a book in mm, the width of a character of the font and the text of the label, it is easy to decide if the label could be displayed horizontally or if it would have to be displayed vertically.
    Input
    Input consists of data about a number of libraries. The final line contains # 0 (separated by a space) ? this line should not be processed.
    For a library, the first line of input will be the name of the library (up to 20 letters only, no spaces), followed by a single positive integer, f, which is the width in mm of a single character in the font used by the library. 1 < f < 8. The next line contains a single integer, c, the number of books to be processed. There then follows c lines, each containing data about 1 book. Each line contains a positive integer, w, the width of the book in mm (5 <= w <=50), and the text to be displayed on the label. The text will contain between 3 and 6 characters.
    Output
    Output for each library begins with the name of the library on a single line, followed by 1 line for every book listed in the input. Each book will begin with "Book n", where n is the number of the book in the library's list, the first book being 1, followed with either the word horizontal, or the word vertical according to how the book is to be displayed.
    Sample Input
    Auckland 3
    6
    11 811
    25 636.7
    38 330.94
    29 398.2
    16 398.6
    18 973.05
    Wellington 4
    3
    35 636
    12 398.2
    9 398.2
    # 0
    Sample Output
    Auckland Library
    Book 1 horizontal
    Book 2 horizontal
    Book 3 horizontal
    Book 4 horizonta
    Book 5 vertical
    Book 6 vertical
    Wellington Library
    Book 1 horizontal
    Book 2 vertical
    Book 3 vertical
    Source

    样例输入

    Auckland 3
    6
    11 811
    25 636.7
    38 330.94
    29 398.2
    16 398.6
    18 973.05
    Wellington 4
    3
    35 636
    12 398.2
    9 398.2
    # 0

    样例输出

    Auckland Library
    Book 1 horizontal
    Book 2 horizontal
    Book 3 horizontal
    Book 4 horizonta
    Book 5 vertical
    Book 6 vertical
    Wellington Library
    Book 1 horizontal
    Book 2 vertical
    Book 3 vertical

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部