السابق التالي
0 / 6
الوحدة النمطية DEMO-32-57DEMO-C-32

Time Addition

DEMO-C-32 • Programming in C

Browser-only practice

بيان المشكلة

Time Addition (24-hour format, Next Day)

You are given a time in 24-hour format (HH MM) and a duration in minutes (k). Your task is to compute the resulting time after adding the duration to the initial time.

If the resulting time is past midnight (i.e., it falls on the next day), append Next day to the output.

Examples

  • Adding 25 minutes to 23:50 results in 00:15 Next day
  • Adding 30 minutes to 10:05 results in 10:35

Notes

  • Use proper formatting with leading zeros for hours and minutes (e.g., 05:07)
  • You may find the modulo operator (%) helpful for handling time wraparound

قيود

0 ≤ HH ≤ 23 0 ≤ MM ≤ 59 0 ≤ k ≤ 2000

تنسيق الإدخال

Input consists of:

  • A line containing two integers HH and MM, representing the starting time in 24-hour format.
  • A second line containing a single integer k, the number of minutes to add.

تنسيق الإخراج

Output the resulting time in HH:MM format.

If the result is past midnight (i.e., the next day), append Next day to the output line.

Example outputs:

  • 10:35
  • 00:15 Next day

حالات اختبار نموذجية

Submit runs every public testcase in this browser. Results and code never leave this device.

العينة رقم 1
عينة ظاهرة
23 50
25
00:15 Next day
Adding 25 minutes to 23:50 results in 00:15 the next day.
العينة رقم 2
عينة ظاهرة
22 45
75
00:00 Next day
Adding 75 minutes to 22:45 results in exactly midnight the next day.
العينة رقم 3
عينة ظاهرة
10 05
30
10:35
Adding 30 minutes to 10:05 results in 10:35 on the same day.

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
إعدادات المحرر