logo AlgoBeat OnlineJudge
登录 注册

#214634. [NCPC 2025] Crochet Competition

内存限制:1024 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

:::align{center}

Crocheting. License: CC BY-SA 3.0 by floret on Wikimedia Commons. :::


The National Crochet Pattern Competition (NCPC) is an annual team-based event for crocheters of all skill levels, from beginner to expert. Teams design, write, and crochet original patterns within a time limit, which can range from minutes to a full week depending on the complexity---sometimes spanning weekends. Contestants may take breaks to eat, sleep, or go home, but the timer continues running.

NCPC has asked you to develop a system that calculates the total competition duration from the start and end times, provided with weekday, hour, and minute. The reported duration should be precise, correctly expressed in days, hours, and minutes, using as few components as necessary while minimizing the sum of the integer values.

输入格式

Input consists of two lines.

  • The first line gives the competition's start time.
  • The second line gives the competition's end time.

Times are formatted as , where

  • is the three-letter weekday abbreviation: , or .
    • the two-digit hour, from to .
    • is the two-digits minutes, from to .

If the start and end times are identical, the competition lasts exactly one week.

输出格式

Output the competition duration in days, hours, and minutes, using the singular or plural form as appropriate (e.g., 1 day, 2 days).

List the components in order -- days, hours, minutes -- separating three components with commas and two with and; omit any component with a value of zero.

样例

样例输入 1

Mon 08:00
Mon 15:00

样例输出 1

7 hours

样例输入 2

Mon 10:00
Wed 08:59

样例输出 2

1 day, 22 hours, 59 minutes

样例输入 3

Fri 20:00
Mon 08:00

样例输出 3

2 days and 12 hours