22250_Time

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

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

Pro.ID

22250

Title

Time

Title链接

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

AC

1

Submit

4

Ratio

25.00%

时间&空间限制

  • Time Limit: 400/200 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    Let a time point be given as 6 integers y, m, d, h, min, s where 1970 ≤ y < 2030,  0 < m < 13,  0 < d < 32,  0 ≤ h < 24,  0 ≤ min < 60,  0 ≤ s < 60 .

    Write a program which computes how many periods of a given length fit between two given time points. A period is given by a pair consisting of a positive integer and a word expressing a time unit, i.e. year or month or day or hour or minute or second. Every 4th year is a leap year, except every 100th which is not except every 400 year which is. A length of the year varies according to leap years. The same is true for the month February. Time units always start as usual, e.g., a year starts at 1st January, a month starts at its 1st day, a day starts at 0 hours 0 minutes 0 seconds, etc. A period ends after its last second.

    输入

    The input file consists of blocks of lines. Each block has three lines. The first line of a block contains a time point D1 and the second line a time point D2. D1 always precedes D2. All numbers in the lines are separated by one space. You can assume that the given descriptions of time points are correct. The third line contains a time period. There is one space between the number and the word in the period definition on this line. After each block, there is one empty line.

    输出

    Description

    Let a time point be given as 6 integers y, m, d, h, min, s where 1970 ≤ y < 2030,  0 < m < 13,  0 < d < 32,  0 ≤ h < 24,  0 ≤ min < 60,  0 ≤ s < 60 .

    Write a program which computes how many periods of a given length fit between two given time points. A period is given by a pair consisting of a positive integer and a word expressing a time unit, i.e. year or month or day or hour or minute or second. Every 4th year is a leap year, except every 100th which is not except every 400 year which is. A length of the year varies according to leap years. The same is true for the month February. Time units always start as usual, e.g., a year starts at 1st January, a month starts at its 1st day, a day starts at 0 hours 0 minutes 0 seconds, etc. A period ends after its last second.

    Input

    The input file consists of blocks of lines. Each block has three lines. The first line of a block contains a time point D1 and the second line a time point D2. D1 always precedes D2. All numbers in the lines are separated by one space. You can assume that the given descriptions of time points are correct. The third line contains a time period. There is one space between the number and the word in the period definition on this line. After each block, there is one empty line.

    Output

    The output file contains the lines corresponding to the blocks in the input file. A line corresponding to a block contains one integer number expressing how many specified periods are contained between the given time points.

    Sample Input

    1997 12 31 23 59 59
    1998 1 1 0 0 0
    1 second

    2000 2 29 0 0 0
    2000 2 29 23 59 59
    1 day

    2000 2 29 0 0 0
    2000 3 1 0 0 0
    24 hour

    1996 12 31 20 30 0
    1997 1 1 7 30 0
    60 minute

    1996 12 31 20 30 0
    1997 1 1 7 30 0
    1 hour

    Sample Output

    1
    0
    1
    11
    10

    Source

    样例输入

    1997 12 31 23 59 59
    1998 1 1 0 0 0
    1 second

    2000 2 29 0 0 0
    2000 2 29 23 59 59
    1 day

    2000 2 29 0 0 0
    2000 3 1 0 0 0
    24 hour

    1996 12 31 20 30 0
    1997 1 1 7 30 0
    60 minute

    1996 12 31 20 30 0
    1997 1 1 7 30 0
    1 hour

    样例输出

    1
    0
    1
    11
    10

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部