LardaX

Sino-the-Walker

Jan 6th, 2017
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.24 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Globalization;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace Sino_the_Walker
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             long[] startTime = Console.ReadLine().Split(':').Select(long.Parse).ToArray();
  15.  
  16.             long hours = startTime[0];
  17.             long minutes = startTime[1];
  18.             long seconds = startTime[2];
  19.  
  20.             long steps = long.Parse(Console.ReadLine());
  21.             int secondsPerStep = int.Parse(Console.ReadLine());
  22.  
  23.             long totalSecondsToWalk = steps * secondsPerStep;
  24.  
  25.             seconds += totalSecondsToWalk;
  26.  
  27.             hours += (long)(Math.Floor((double)(seconds / 3600)));
  28.             seconds = seconds % 3600;
  29.             minutes += (long)(Math.Floor((double)(seconds / 60)));
  30.             seconds = seconds % 60;
  31.  
  32.             while (minutes >= 60)
  33.             {
  34.                 hours++;
  35.                 minutes -= 60;
  36.             }
  37.  
  38.             hours %= 24;
  39.  
  40.             Console.WriteLine("Time Arrival: {0}:{1}:{2}", hours.ToString().PadLeft(2, '0'), minutes.ToString().PadLeft(2, '0'), seconds.ToString().PadLeft(2, '0'));
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment