Advertisement
Guest User

Video Durations (updated)

a guest
Oct 8th, 2015
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Text.RegularExpressions;
  6.  
  7. class UserLogs
  8. {
  9.     static void Main()
  10.     {
  11.         int totalMinutes = 0;
  12.         string input = Console.ReadLine();
  13.        
  14.         while (input != "End")
  15.         {
  16.             int[] arr = input.Split(':').Select(int.Parse).ToArray();
  17.             int mins = arr[1];
  18.             int hours = arr[0];
  19.             totalMinutes += hours * 60 + mins;
  20.  
  21.             input = Console.ReadLine();
  22.         }
  23.  
  24.         int totalHours = totalMinutes / 60;
  25.         totalMinutes %= 60;
  26.         Console.WriteLine("{0}:{1}", totalHours, totalMinutes.ToString("D2"));
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement