Advertisement
braveheart1989

Sudoku_Result

Feb 15th, 2016
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.70 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 _02.Sudoku_Result
  9. {
  10.     class Sudoku_Result
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             string  format;
  15.             TimeSpan timeInterval = new TimeSpan(0,0,0);
  16.             TimeSpan timeSum      = new TimeSpan(0, 0, 0);
  17.  
  18.             CultureInfo culture;
  19.             culture = CultureInfo.InvariantCulture;
  20.             format = "mm\\:ss";
  21.             string command = "";
  22.             int counter = 1;
  23.  
  24.             while (command != "Quit")
  25.             {
  26.                 timeInterval = TimeSpan.ParseExact(Console.ReadLine(), format, culture);
  27.                 command = Console.ReadLine();
  28.                 timeSum += timeInterval;
  29.                 counter++;
  30.             }
  31.             bool isGold = (timeSum.TotalSeconds) / counter < 720;
  32.  
  33.             if (isGold)
  34.             {
  35.                 Console.WriteLine("Gold Star");
  36.                 Console.WriteLine("Games - {0} \\ Average seconds - {1}",counter, Math.Floor(timeSum.TotalSeconds/ counter));
  37.             }
  38.  
  39.             else if (timeSum.TotalSeconds / counter > 720 && timeSum.TotalSeconds / counter < 1440)
  40.             {
  41.                 Console.WriteLine("Silver Star");
  42.                 Console.WriteLine("Games - {0} \\ Average seconds - {1}", counter, Math.Floor(timeSum.TotalSeconds / counter));
  43.             }
  44.             else
  45.             {
  46.                 Console.WriteLine("Bronze Star");
  47.                 Console.WriteLine("Games - {0} \\ Average seconds - {1}", counter, Math.Floor(timeInterval.TotalSeconds / counter));
  48.             }
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement