o_ignatov

01. Sino The Walker

Jul 3rd, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Numerics;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace _01SinoTheWalker
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. int[] times = Console.ReadLine().Split(':').Select(int.Parse).ToArray();
  15. uint stepsCount = uint.Parse(Console.ReadLine());
  16. uint stepTime = uint.Parse(Console.ReadLine());
  17. BigInteger addedSeconds = stepsCount * stepTime;
  18. GetArrivalTime(times, addedSeconds);
  19.  
  20. }
  21.  
  22. private static void GetArrivalTime(int[] times, BigInteger addedSeconds)
  23. {
  24. BigInteger totalSeconds = addedSeconds + times[2] + times[1] * 60 + times[0] * 3600;
  25. int hours = (int)(totalSeconds / 3600);
  26. int remainder = (int)(totalSeconds % 3600);
  27. int minutes = remainder / 60;
  28. int seconds = remainder % 60;
  29. if (hours > 23)
  30. {
  31. hours %= 24;
  32. }
  33. Console.WriteLine($"Time Arrival: {hours:d2}:{minutes:d2}:{seconds:d2}");
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment