Guest User

Untitled

a guest
Jan 31st, 2022
933
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.41 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. namespace _08TennisRanklist
  8. {
  9.     internal class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int numTour = int.Parse(Console.ReadLine());
  14.             int startPoints = int.Parse(Console.ReadLine());
  15.  
  16.             double sumW = 0;
  17.             double sumF = 0;
  18.             double sumSf = 0;
  19.             double numW = 0;
  20.  
  21.             for (int i = 1; i <= numTour; i++)
  22.             {
  23.                 string lvl = Console.ReadLine();
  24.  
  25.                 if (lvl == "W")
  26.                 {
  27.                     sumW = sumW + 2000 ;
  28.                     numW++;
  29.                 }
  30.                 else if (lvl == "F")
  31.                 {
  32.                     sumF += 1200;
  33.                 }
  34.                 else if (lvl == "SF")
  35.                 {
  36.                     sumSf += 720;
  37.                 }
  38.  
  39.             }
  40.             double prWins = numW / numTour * 100;
  41.             double sumFromTour = sumSf + sumW + sumF;
  42.             double allPoints = sumSf + sumW + sumF + startPoints;
  43.             double averagePoints = Math.Floor(sumFromTour / numTour);
  44.  
  45.  
  46.             Console.WriteLine($"Final points: {allPoints}");
  47.             Console.WriteLine($"Average points: {averagePoints}");
  48.             Console.WriteLine($"{prWins:f2}%");
  49.         }
  50.  
  51.     }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment