Spocoman

08. Tennis Ranklist

Nov 20th, 2021 (edited)
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.15 KB | None | 0 0
  1. using System;
  2.  
  3. namespace TennisRanklist
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int tournamentsNumbers = int.Parse(Console.ReadLine());
  10.             int points = int.Parse(Console.ReadLine());
  11.             int tournamentPoints = 0;
  12.             int win = 0;
  13.  
  14.             for (int i = 0; i < tournamentsNumbers; i++)
  15.             {
  16.                 string currentTournament = Console.ReadLine();
  17.  
  18.                 if (currentTournament == "W")
  19.                 {
  20.                     tournamentPoints += 2000;
  21.                     win++;
  22.                 }
  23.                 else if (currentTournament == "F")
  24.                 {
  25.                     tournamentPoints += 1200;
  26.                 }
  27.                 else if (currentTournament == "SF")
  28.                 {
  29.                     tournamentPoints += 720;
  30.                 }
  31.             }
  32.    
  33.             Console.WriteLine($"Final points: {points + tournamentPoints}");
  34.             Console.WriteLine($"Average points: {tournamentPoints / tournamentsNumbers}");
  35.             Console.WriteLine($"{100.0 * win / tournamentsNumbers:f2}%");
  36.         }
  37.     }
  38. }
  39.  
Add Comment
Please, Sign In to add comment