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("{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("{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.  
Runtime error #stdin #stdout 0.04s 39648KB
stdin
08:00
15
15
15
stdout
Standard output is empty