Advertisement
ivanov_ivan

SudokuResult

Feb 18th, 2016
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.74 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace SudokuResults
  8.     {
  9.     class SudokuResults
  10.         {
  11.         static void Main()
  12.             {
  13.             string[] input = Console.ReadLine().Split(':');
  14.             double minutesConvertedToSeconds;
  15.             double seconds;
  16.             double totalSeconds = 0;
  17.             double countOfGames = 0;
  18.  
  19.             while (input[0] != "Quit")
  20.                 {
  21.                 minutesConvertedToSeconds = double.Parse(input[0]) * 60;
  22.                 seconds = double.Parse(input[1]);
  23.                 totalSeconds += minutesConvertedToSeconds + seconds;
  24.                 countOfGames++;
  25.                 input = Console.ReadLine().Split(':');
  26.                 }
  27.  
  28.             double avarageSeconds = Math.Ceiling(totalSeconds / countOfGames);
  29.  
  30.             if (avarageSeconds < 720 && avarageSeconds >= 0)
  31.                 {
  32.                 Console.WriteLine("Gold Star");
  33.                 Console.WriteLine("Games - {0} \\ Average seconds - {1}",countOfGames,avarageSeconds);
  34.                 }
  35.             else
  36.                 {
  37.                 if (avarageSeconds >= 720 && avarageSeconds <= 1440 )
  38.                     {
  39.                     Console.WriteLine("Silver Star");
  40.                     Console.WriteLine("Games - {0} \\ Average seconds - {1}", countOfGames, avarageSeconds);
  41.                     }
  42.                 else if (avarageSeconds > 1440)
  43.                     {
  44.                     Console.WriteLine("Bronze Star");
  45.                     Console.WriteLine("Games - {0} \\ Average seconds - {1}", countOfGames, avarageSeconds);
  46.                     }
  47.                 }
  48.             }
  49.         }
  50.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement