fork download
  1. using System;
  2. using System.Text;
  3. using System.Collections.Generic;
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. string[] poczatek = Console.ReadLine().Trim().Split(':');
  9. int[] czas = new int[]
  10. {
  11. int.Parse(poczatek[0]),
  12. int.Parse(poczatek[1])
  13. };
  14. string p;
  15. List<int> przerwy = new List<int>();
  16. while ((p = Console.ReadLine()) != null)
  17. {
  18. przerwy.Add(int.Parse(p));
  19. }
  20.  
  21. int a = 0;
  22. int max = przerwy.Count - 1;
  23. StringBuilder sb = new StringBuilder();
  24. do
  25. {
  26. sb.Append(string.Format("{0:00}:{1:00},", czas[0], czas[1]));
  27. czas[1] += przerwy[a++];
  28. if (czas[1] >= 60)
  29. {
  30. do
  31. {
  32. czas[0]++;
  33. czas[1] -= 60;
  34. } while (czas[1] >= 60);
  35. }
  36. if (czas[0] > 24)
  37. {
  38. do
  39. {
  40. czas[0] -= 24;
  41. } while (czas[0] > 24);
  42. }
  43. if (czas[0] == 24)
  44. {
  45. czas[0] = 0;
  46. sb.Append(string.Format("{0:00}:{1:00}", czas[0], czas[1]));
  47. break;
  48. }
  49. if (a > max)
  50. a = 0;
  51. } while (czas[0] + czas[1] < 84);
  52. if(sb[sb.Length-1]==',')
  53. Console.Write(sb.ToString().Remove(sb.Length - 1));
  54. else
  55. Console.Write(sb.ToString());
  56. }
  57. }
  58.  
Success #stdin #stdout 0.03s 37040KB
stdin
08:00
15
15
15
stdout
08:00,08:15,08:30,08:45,09:00,09:15,09:30,09:45,10:00,10:15,10:30,10:45,11:00,11:15,11:30,11:45,12:00,12:15,12:30,12:45,13:00,13:15,13:30,13:45,14:00,14:15,14:30,14:45,15:00,15:15,15:30,15:45,16:00,16:15,16:30,16:45,17:00,17:15,17:30,17:45,18:00,18:15,18:30,18:45,19:00,19:15,19:30,19:45,20:00,20:15,20:30,20:45,21:00,21:15,21:30,21:45,22:00,22:15,22:30,22:45,23:00,23:15,23:30,23:45,00:00