Advertisement
ivanov_ivan

Teo

Feb 15th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.84 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Globalization;
  4. using System.Linq;
  5. using System.Numerics;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Threading;
  9.  
  10. namespace Test
  11. {
  12.     class ThreeEqualNumber
  13.     {
  14.         static void Main()
  15.         {
  16.             string format;
  17.             TimeSpan timeInterval = new TimeSpan(0 , 0 , 0);
  18.             TimeSpan timeSum = new TimeSpan(0 , 0 , 0);
  19.  
  20.             //CultureInfo culture;
  21.             //culture = CultureInfo.InvariantCulture;
  22.             //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
  23.             format = "mm\\:ss";
  24.             string command = Console.ReadLine();
  25.             int counter = 1;
  26.  
  27.             while(command != "Quit")
  28.             {
  29.                 timeInterval = TimeSpan.ParseExact(command , format , null);
  30.                 timeSum += timeInterval;
  31.                 counter++;
  32.                 command = Console.ReadLine();
  33.             }
  34.  
  35.             bool isGold = ( timeSum.TotalSeconds ) / counter < 720;
  36.  
  37.             if(isGold)
  38.             {
  39.                 Console.WriteLine("Gold Star");
  40.                 Console.WriteLine("Games - {0} \\ Average seconds - {1}" , counter , Math.Ceiling(timeSum.TotalSeconds / counter));
  41.             }
  42.  
  43.             else if(timeSum.TotalSeconds / counter > 720 && timeSum.TotalSeconds / counter < 1440)
  44.             {
  45.                 Console.WriteLine("Silver Star");
  46.                 Console.WriteLine("Games - {0} \\ Average seconds - {1}" , counter , Math.Ceiling(timeSum.TotalSeconds / counter));
  47.             }
  48.             else
  49.             {
  50.                 Console.WriteLine("Bronze Star");
  51.                 Console.WriteLine("Games - {0} \\ Average seconds - {1}" , counter , Math.Ceiling(timeInterval.TotalSeconds / counter));
  52.             }
  53.         }
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement