22072_MoscowTime

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

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

Pro.ID

22072

Title

Moscow Time

Title链接

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

AC

3

Submit

6

Ratio

50.00%

时间&空间限制

  • Time Limit: 600/300 MS (Java/Others)     Memory Limit: 32768/32768 K (Java/Others)
  • 描述

    In e-mail the following format for date and time setting is used:

    EDATE::=Day_of_week, Day_of_month Month Year Time Time_zone

    Here EDATE is the name of date and time format, the text to the right from "::=" defines how date and time are written in this format. Below the descriptions of EDATE fields are presented:

    Day-of-week

    The name of a day of the week. Possible values: MON, TUE, WED, THU, FRI, SAT, SUN. The name is followed by "," character (a comma).

    Day-of-month

    A day of the month. Set by two decimal digits.

    Month

    The name of the month. Possible values: JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC.

    Year

    Set by two or four decimal digits. If a year is set by two decimals it is assumed that this is a number of the year of the XX century. For instance, 74 and 1974 set a year of 1974.

    Time

    Local time in format hours:minutes:seconds, where hours, minutes and seconds are made up of two decimal digits. The time keeps within the limits from 00:00:00 to 23:59:59.

    Time-zone

    Offset of local time from Greenwich mean time. It is set by the difference sign "+" or "-" and by sequence of four digits. First two digits set the hours and the last two the minutes of offset value. The absolute value of the difference does not exceed 24 hours. Time zone can also be presented by one of the following names:

    Name Digital value

    UT   -0000GMT  -0000EDT  -0400CDT  -0500MDT  -0600PDT  -0700

    Each two adjacent fields of EDATA are separated with exactly one space. Names of day of the week, month and time zone are written in capitals. For instance, 10 a.m. of the Contest day in St.Petersburg can be presented as


    TUE, 03 DEC 96 10:00:00 +0300

    Write a program which transforms the given date and time in EDATE format to the corresponding date and time in Moscow time zone. So called "summer time" is not taken into consideration. Your program should rely on the predefined correctness of the given Day-of-week and Time-zone.

    A note

    Moscow time is 3 hours later than Greenwich mean time (time zone +0300)
    Months: January, March, May, July, August, October and December have 31 days. Months: April, June, September and November have 30 days. February, as a rule, has 28 days, save for the case of the leap year (29 days).

    A year is a leap year if valid one out of two following conditions:
    its number is divisible by 4 and is not divisible by 100;
    its number is divisible by 400.
    For instance, 1996 and 2000 are the leap years, while 1900 and 1997 are not.

    输入

    There are multiple test cases, one test case per line.

    Every line contains date and time in EDATE format. Minimum permissible year in the input data is 0001, maximum is 9998. Input EDATA string does not contain leading and trailing spaces.

    输出

    Description

    In e-mail the following format for date and time setting is used:

    EDATE::=Day_of_week, Day_of_month Month Year Time Time_zone

    Here EDATE is the name of date and time format, the text to the right from "::=" defines how date and time are written in this format. Below the descriptions of EDATE fields are presented:

    Day-of-week

    The name of a day of the week. Possible values: MON, TUE, WED, THU, FRI, SAT, SUN. The name is followed by "," character (a comma).

    Day-of-month

    A day of the month. Set by two decimal digits.

    Month

    The name of the month. Possible values: JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC.

    Year

    Set by two or four decimal digits. If a year is set by two decimals it is assumed that this is a number of the year of the XX century. For instance, 74 and 1974 set a year of 1974.

    Time

    Local time in format hours:minutes:seconds, where hours, minutes and seconds are made up of two decimal digits. The time keeps within the limits from 00:00:00 to 23:59:59.

    Time-zone

    Offset of local time from Greenwich mean time. It is set by the difference sign "+" or "-" and by sequence of four digits. First two digits set the hours and the last two the minutes of offset value. The absolute value of the difference does not exceed 24 hours. Time zone can also be presented by one of the following names:

    Name Digital value

    UT   -0000GMT  -0000EDT  -0400CDT  -0500MDT  -0600PDT  -0700

    Each two adjacent fields of EDATA are separated with exactly one space. Names of day of the week, month and time zone are written in capitals. For instance, 10 a.m. of the Contest day in St.Petersburg can be presented as


    TUE, 03 DEC 96 10:00:00 +0300

    Write a program which transforms the given date and time in EDATE format to the corresponding date and time in Moscow time zone. So called "summer time" is not taken into consideration. Your program should rely on the predefined correctness of the given Day-of-week and Time-zone.

    A note

    Moscow time is 3 hours later than Greenwich mean time (time zone +0300)
    Months: January, March, May, July, August, October and December have 31 days. Months: April, June, September and November have 30 days. February, as a rule, has 28 days, save for the case of the leap year (29 days).

    A year is a leap year if valid one out of two following conditions:
    its number is divisible by 4 and is not divisible by 100;
    its number is divisible by 400.
    For instance, 1996 and 2000 are the leap years, while 1900 and 1997 are not.

    Input

    There are multiple test cases, one test case per line.

    Every line contains date and time in EDATE format. Minimum permissible year in the input data is 0001, maximum is 9998. Input EDATA string does not contain leading and trailing spaces.

    Output

    For every test case, output a single line with date and time of Moscow time zone in EDATE format. In output EDATE string a Year should be ONLY presented in 4 decimal digits format. The output string should not include leading and trailing spaces.

    Sample Input

    SUN, 03 DEC 1996 09:10:35 GMT
    MON, 23 JUL 1987 23:23:45 EDT

    Sample Output

    SUN, 03 DEC 1996 12:10:35 +0300
    TUE, 24 JUL 1987 06:23:45 +0300

    Source

    样例输入

    SUN, 03 DEC 1996 09:10:35 GMT
    MON, 23 JUL 1987 23:23:45 EDT

    样例输出

    SUN, 03 DEC 1996 12:10:35 +0300
    TUE, 24 JUL 1987 06:23:45 +0300

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部