Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Party
- {
- static void Main()
- {
- //Telerik Academy
- //Within 24 hour time span you have a start and end time of a party. A music band sings 5-minute songs and wants to know the maximum amount of songs they would sing. If there is no time for a last song they won't start singing it. The format for the start and end times is: 16 01 and on the next row 17 30
- string inputStartTime = Console.ReadLine(),
- inputEndTime = Console.ReadLine();
- string[] inputStartTimeSplitted = inputStartTime.Split(' ');
- int[] startTime = Array.ConvertAll<string, int>(inputStartTimeSplitted, int.Parse);
- string[] inputEndTimeSplitted = inputEndTime.Split(' ');
- int[] endTime = Array.ConvertAll<string, int>(inputEndTimeSplitted, int.Parse);
- int startMinutes = startTime[0] * 60 + startTime[1];
- int endMinutes = endTime[0] * 60 + endTime[1];
- int timeSpan = endMinutes - startMinutes;
- int numberOfSongs = timeSpan / 5;
- Console.WriteLine(numberOfSongs);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement