10065_Calendar

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

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

Pro.ID

10065

Title

Calendar

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 300/100 MS (Java/Others)     Memory Limit: 10000/5000 K (Java/Others)
  • 描述

    Most of us have a calendar on which we scribble details of important events in our lives--visits to the dentist, the Regent 24 hour book sale, Programming Contests and so on. However there are also the fixed dates: partner's birthdays, wedding anniversaries and the like; and we also need to keep track of these. Typically we need to be reminded of when these important dates are approaching--the more important the event, the further in advance we wish to have our memories jogged.

    Write a program that will provide such a service. The input will specify the year for which the calendar is relevant (in the range 1901 to 1999). Bear in mind that, within the range specified, all years that are divisible by 4 are leap years and hence have an extra day (February 29th) added. The output will specify "today's" date, a list of forthcoming events and an indication of their relative importance.

    输入

    The first line of input will contain an integer representing the year (in the range 1901 to 1999). This will be followed by a series of lines representing anniversaries or days for which the service is requested.

    An anniversary line will consist of the letter 'A'; three integer numbers ( D, M, P ) representing the date, the month and the importance of the event; and a string describing the event, all separated by one or more spaces. P will be a number between 1 and 7 (both inclusive) and represents the number of days before the event that the reminder service should start. The string describing the event will always be present and will start at the first non-blank character after the priority.

    A date line will consist of the letter 'D' and the date and month as above.

    All anniversary lines will precede any date lines. No line will be longer than 255 characters in total. The file will be terminated by a line consisting of a single #.

    输出

    Description

    Most of us have a calendar on which we scribble details of important events in our lives--visits to the dentist, the Regent 24 hour book sale, Programming Contests and so on. However there are also the fixed dates: partner's birthdays, wedding anniversaries and the like; and we also need to keep track of these. Typically we need to be reminded of when these important dates are approaching--the more important the event, the further in advance we wish to have our memories jogged.

    Write a program that will provide such a service. The input will specify the year for which the calendar is relevant (in the range 1901 to 1999). Bear in mind that, within the range specified, all years that are divisible by 4 are leap years and hence have an extra day (February 29th) added. The output will specify "today's" date, a list of forthcoming events and an indication of their relative importance.

    Input

    The first line of input will contain an integer representing the year (in the range 1901 to 1999). This will be followed by a series of lines representing anniversaries or days for which the service is requested.

    An anniversary line will consist of the letter 'A'; three integer numbers ( D, M, P ) representing the date, the month and the importance of the event; and a string describing the event, all separated by one or more spaces. P will be a number between 1 and 7 (both inclusive) and represents the number of days before the event that the reminder service should start. The string describing the event will always be present and will start at the first non-blank character after the priority.

    A date line will consist of the letter 'D' and the date and month as above.

    All anniversary lines will precede any date lines. No line will be longer than 255 characters in total. The file will be terminated by a line consisting of a single #.

    Output

    Output will consist of a series of blocks of lines, one for each date line in the input. Each block will consist of the requested date followed by the list of events for that day and as many following days as necessary.

    The output should specify the date of the event (D and M), right justified in fields of width 3, and the relative importance of the event. Events that happen today should be flagged as shown below, events that happen tomorrow should have P stars, events that happen the day after tomorrow should have P-1 stars, and so on. If several events are scheduled for the same day, order them by relative importance (number of stars).

    If there is still a conflict, order them by their appearance in the input stream. Follow the format used in the example below. Leave 1 blank line between blocks.

    Sample Input
    1993
    A 23 12 5 Partner's birthday
    A 25 12 7    Christmas
    A 20 12 1 Unspecified Anniversary
    D 20 12
    #
    Sample Output
    Today is: 20 12
     20 12 *TODAY* Unspecified Anniversary
     23 12 ***     Partner's birthday
     25 12 ***     Christmas

    样例输入

    1993
    A 23 12 5 Partner's birthday
    A 25 12 7    Christmas
    A 20 12 1 Unspecified Anniversary
    D 20 12
    #

    样例输出

    Today is: 20 12
     20 12 *TODAY* Unspecified Anniversary
     23 12 ***     Partner's birthday
     25 12 ***     Christmas

    提示

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部