Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- class OnTimeForTheExam
- {
- static void Main()
- {
- int h = int.Parse(Console.ReadLine());
- int m = int.Parse(Console.ReadLine());
- int hourArrive = int.Parse(Console.ReadLine());
- int minuteArrive = int.Parse(Console.ReadLine());
- if (h == hourArrive)
- {
- if (m == minuteArrive)
- {
- Console.WriteLine("On time"); return;
- }
- else if (m > minuteArrive)
- {
- if (Math.Abs(m - minuteArrive) <= 30)
- {
- Console.WriteLine("On time");
- Console.WriteLine("{0} minutes before before the start", Math.Abs(m - minuteArrive)); return;
- }
- else
- {
- Console.WriteLine("Early");
- Console.WriteLine("{0} minutes before before the start", Math.Abs(m - minuteArrive)); return;
- }
- }
- else
- {
- Console.WriteLine("Late");
- Console.WriteLine("{0} minutes after the start", Math.Abs(m - minuteArrive)); return;
- }
- }
- else if (hourArrive > h)
- {
- if (((hourArrive * 60 + minuteArrive) - (h * 60 + m)) < 60)
- {
- Console.WriteLine("Late");
- Console.WriteLine("{0} minutes after the start", (hourArrive * 60 + minuteArrive) - (h * 60 + m)); return;
- }
- else
- {
- Console.WriteLine("Late");
- Console.WriteLine("{0}:{1:00} hours after the start", hourArrive - h, Math.Abs(m - minuteArrive)); return;
- }
- }
- else
- {
- if (h - hourArrive == 1)
- {
- if (60 - minuteArrive + m <= 30)
- {
- Console.WriteLine("On time");
- Console.WriteLine("{0} minutes before the start", 60 - minuteArrive); return;
- }
- else
- {
- Console.WriteLine("Early");
- if (m == minuteArrive)
- {
- Console.WriteLine("{0}:00 hours before the start", Math.Abs(h - hourArrive));
- return;
- }
- Console.WriteLine("{0} minutes before the start", 60 - minuteArrive + m);
- }
- }
- else
- {
- Console.WriteLine("Early");
- Console.WriteLine("{0}:{1:00} hours before the start", Math.Abs(hourArrive - h), Math.Abs(minuteArrive - m));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement