Advertisement
vencinachev

Tennis-2

Nov 21st, 2021
1,024
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.12 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Loops
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int turniri = int.Parse(Console.ReadLine());
  10.             int points = int.Parse(Console.ReadLine());
  11.             int start = points;
  12.             int wins = 0;
  13.             for (int i = 0; i < turniri; i++)
  14.             {
  15.                 string type = Console.ReadLine();
  16.                 switch (type)
  17.                 {
  18.                     case "W":
  19.                         points += 2000;
  20.                         wins++;
  21.                         break;
  22.                     case "SF":
  23.                         points += 720;
  24.                         break;
  25.                     case "F":
  26.                         points += 1200;
  27.                         break;
  28.                 }
  29.             }
  30.             double procent = (wins * 100.0) / turniri;
  31.             double avg = Math.Floor((double)(points - start) / turniri);
  32.             Console.WriteLine($"Final points: {points}");
  33.             Console.WriteLine($"Average points: {avg}");
  34.             Console.WriteLine($"{procent:F2}%");
  35.         }
  36.     }
  37. }
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement