Advertisement
VickSuna

Untitled

Feb 28th, 2020
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _429_On_Time_for_the_Exam
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int examHour = int.Parse(Console.ReadLine());
  10. int examMinutes = int.Parse(Console.ReadLine());
  11. int arriveHour = int.Parse(Console.ReadLine());
  12. int arriveMinutes = int.Parse(Console.ReadLine());
  13.  
  14. int exam = (examHour * 60) + examMinutes;
  15. int arrive = (arriveHour * 60) + arriveMinutes;
  16.  
  17. if (exam == arrive)
  18. {
  19. Console.WriteLine("On time");
  20. }
  21. else if (exam < arrive)
  22. {
  23. if ((arrive - exam) < 60)
  24. {
  25. int minutesLate1 = arrive - exam;
  26. Console.WriteLine("Late");
  27. Console.WriteLine($"{minutesLate1} minutes after the start");
  28. }
  29. else
  30. {
  31. int hoursLate = (arrive - exam) / 60;
  32. int minutesLate2 = (arrive - exam) % 60;
  33. Console.WriteLine("Late");
  34. Console.WriteLine($"{hoursLate}:{minutesLate2:D2} hours after the start");
  35. }
  36. }
  37. else if (exam > arrive)
  38. {
  39. if ((exam - arrive) <= 30)
  40. {
  41. int minutesEarly0 = exam - arrive;
  42. Console.WriteLine("On time");
  43. Console.WriteLine($"{minutesEarly0} minutes before the start");
  44. }
  45. else if ((exam - arrive) < 60)
  46. {
  47. int minutesEarly1 = exam - arrive;
  48. Console.WriteLine("Early");
  49. Console.WriteLine($"{minutesEarly1:D2} minutes before the start");
  50. }
  51. else
  52. {
  53. int hoursEarly = (exam - arrive) / 60;
  54. int minutesEarly2 = (exam - arrive) % 60;
  55. Console.WriteLine("Early");
  56. Console.WriteLine($"{hoursEarly}:{minutesEarly2:D2} hours before the start");
  57. }
  58. }
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65. }
  66. }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement