21426_DemeritPoints

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

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

Pro.ID

21426

Title

Demerit Points

Title链接

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

AC

0

Submit

3

Ratio

0.00%

时间&空间限制

  • Time Limit: 1000/500 MS (Java/Others)     Memory Limit: 32768/32768 K (Java/Others)
  • 描述

    A province to our west, which shall remain nameless, but whose name does not start with A, B, or S, has a unique system for driver's license demerit and merit points. The system works (more or less) as follows.
    A new driver starts with no merit or demerit points. When the driver is convicted of a driving offense, he or she is given between 2 and 15 demerit points, depending on the severity of the offense.

    A merit point is given, to a maximum of five, for each interval of two years in which a driver has no offenses and no demerit points. Each merit point cancels up to two demerit points. If a subsequent offense occurs and the number of demerit points exceeds double the number of merit points, the number of demerit points is reduced by double the number of merit points, and the number of merit points is set to 0. If a subsequent offense occurs and the number of demerit points is less than or equal to double the number of merit points, the number of demerit points is reduced to 0, and the number of merit points is reduced by half the number of demerit points. Any fractional merit points are discarded.

    Demerit points are reduced whenever a driver has one year free of any driving offense. This reduction decreases the number of demerits by half or by 2, whichever is more. Any fractional or negative demerit points are discarded. This reduction takes place on each anniversary of the most recent offense until no points remain.

    If a new offense occurs on the same day as a demerit point reduction or merit point award, the reduction/award is done before the new demerit points are given.

    Your job is to read a set of information records for a driver, and to print the number of merit or demerit points at any given time.

    输入

    The first line of input contains the date of issue of the license (yyyymmdd) Subsequent lines contain information on offenses, in chronological order. Each such line contains the offense date (yyyymmdd) and the number of points applied (an integer between 2 and 15).

    输出

    Description

    A province to our west, which shall remain nameless, but whose name does not start with A, B, or S, has a unique system for driver's license demerit and merit points. The system works (more or less) as follows.
    A new driver starts with no merit or demerit points. When the driver is convicted of a driving offense, he or she is given between 2 and 15 demerit points, depending on the severity of the offense.

    A merit point is given, to a maximum of five, for each interval of two years in which a driver has no offenses and no demerit points. Each merit point cancels up to two demerit points. If a subsequent offense occurs and the number of demerit points exceeds double the number of merit points, the number of demerit points is reduced by double the number of merit points, and the number of merit points is set to 0. If a subsequent offense occurs and the number of demerit points is less than or equal to double the number of merit points, the number of demerit points is reduced to 0, and the number of merit points is reduced by half the number of demerit points. Any fractional merit points are discarded.

    Demerit points are reduced whenever a driver has one year free of any driving offense. This reduction decreases the number of demerits by half or by 2, whichever is more. Any fractional or negative demerit points are discarded. This reduction takes place on each anniversary of the most recent offense until no points remain.

    If a new offense occurs on the same day as a demerit point reduction or merit point award, the reduction/award is done before the new demerit points are given.

    Your job is to read a set of information records for a driver, and to print the number of merit or demerit points at any given time.

    Input
    The first line of input contains the date of issue of the license (yyyymmdd) Subsequent lines contain information on offenses, in chronological order. Each such line contains the offense date (yyyymmdd) and the number of points applied (an integer between 2 and 15).
    Output

    On the day the license is issued, and on every occasion that the number of merit or demerit points changes, output a line giving the date and the number of points, in the format below. Output terminates when 5 merit points are accumulated following the last offense.

    Sample Input
    19820508
    19830606 2
    19830607 2
    19891212 15
    Sample Output

    1982-05-08 No merit or demerit points.
    1983-06-06 2 demerit point(s).
    1983-06-07 4 demerit point(s).
    1984-06-07 2 demerit point(s).
    1985-06-07 No merit or demerit points.
    1987-06-07 1 merit point(s).
    1989-06-07 2 merit point(s).
    1989-12-12 11 demerit point(s).
    1990-12-12 5 demerit point(s).
    1991-12-12 2 demerit point(s).
    1992-12-12 No merit or demerit points.
    1994-12-12 1 merit point(s).
    1996-12-12 2 merit point(s).
    1998-12-12 3 merit point(s).
    2000-12-12 4 merit point(s).
    2002-12-12 5 merit point(s).

    Source

    样例输入

    19820508
    19830606 2
    19830607 2
    19891212 15

    样例输出

    1982-05-08 No merit or demerit points.
    1983-06-06 2 demerit point(s).
    1983-06-07 4 demerit point(s).
    1984-06-07 2 demerit point(s).
    1985-06-07 No merit or demerit points.
    1987-06-07 1 merit point(s).
    1989-06-07 2 merit point(s).
    1989-12-12 11 demerit point(s).
    1990-12-12 5 demerit point(s).
    1991-12-12 2 demerit point(s).
    1992-12-12 No merit or demerit points.
    1994-12-12 1 merit point(s).
    1996-12-12 2 merit point(s).
    1998-12-12 3 merit point(s).
    2000-12-12 4 merit point(s).
    2002-12-12 5 merit point(s).

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部