Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Hotel_Room
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int examHours = int.Parse(Console.ReadLine());
- int examMinutes = int.Parse(Console.ReadLine());
- int arriveHours = int.Parse(Console.ReadLine());
- int arriveMinutes = int.Parse(Console.ReadLine());
- int arriveHoursMinutes = arriveMinutes + arriveHours * 60;
- int examHoursMinutes = examMinutes + examHours * 60;
- int hours = 0;
- int minutes = 0;
- if (examHours == arriveHours && examMinutes == arriveMinutes)
- {
- Console.WriteLine("On time");
- }
- else if (examHoursMinutes > arriveHoursMinutes)
- {
- int earlyMinutes = examHoursMinutes - arriveHoursMinutes;
- int earlyHours = examHours - arriveHours;
- hours = earlyMinutes / 60;
- minutes = earlyMinutes % 60;
- if (earlyHours >= 1 && examMinutes >= arriveMinutes)
- {
- Console.WriteLine($"Early {earlyHours}:{minutes:d2} hours before the start");
- }
- else
- {
- if (minutes <= 30 || examMinutes == arriveMinutes)
- {
- Console.WriteLine($"On time {minutes} minutes before the start");
- }
- else if (hours >= 1 || minutes > 30 && minutes > 59)
- {
- Console.WriteLine($"Early {hours}:{minutes} hours before the start");
- }
- else if (minutes <= 59)
- {
- Console.WriteLine($"Early {minutes} minutes before the start");
- }
- }
- }
- else
- {
- int lateMinutes = arriveHoursMinutes - examHoursMinutes;
- hours = lateMinutes / 60;
- minutes = lateMinutes % 60;
- if (hours >= 1 || minutes > 59)
- {
- Console.WriteLine($"Late {hours}:{minutes} hours after the start");
- }
- else if (minutes <= 59)
- {
- Console.WriteLine($"Late {minutes} minutes after the start");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement