Advertisement
miroLLL

SudokuResults

Nov 17th, 2015
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.37 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.  
  8. class SudokuResults
  9. {
  10.     static void Main()
  11.     {
  12.         decimal plays = 0.0M;
  13.         int allInSeconds = 0;
  14.  
  15.         while (true)
  16.         {
  17.             string timeInString = Console.ReadLine();
  18.             if (timeInString == "Quit")
  19.             {
  20.                 break;
  21.             }
  22.             string[] splitString = timeInString.Split(':');
  23.             int minutes = int.Parse(splitString[0]);
  24.             int seconds = int.Parse(splitString[1]);
  25.             minutes *= 60;
  26.             minutes += seconds;
  27.             plays++;
  28.             allInSeconds += minutes;
  29.         }
  30.  
  31.         decimal avg = allInSeconds / plays;
  32.        
  33.         if (avg < 720)
  34.         {
  35.             Console.WriteLine("Gold Star");
  36.             Console.WriteLine("Games - {0:F0} \\ Average seconds - {1}", plays, Math.Ceiling(avg));
  37.         }
  38.         else if (avg >= 720 && avg <= 1440)
  39.         {
  40.             Console.WriteLine("Silver Star");
  41.             Console.WriteLine("Games - {0:F0} \\ Average seconds - {1}", plays, Math.Ceiling(avg));
  42.         }
  43.         else if (avg >= 1440)
  44.         {
  45.             Console.WriteLine("Bronze Star");
  46.             Console.WriteLine("Games - {0:F0} \\ Average seconds - {1}", plays, Math.Ceiling(avg));
  47.         }
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement