Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
932
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.46 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 _05.Tennis_Ranklist
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int numberOfTournaments = int.Parse(Console.ReadLine());
  14.             int startingPoint = int.Parse(Console.ReadLine());
  15.             string stage = string.Empty;
  16.             int points = 0;
  17.             double average = 0;
  18.             double percent = 0;
  19.             int numberOfWonTournaments = 0;
  20.  
  21.             points = startingPoint;
  22.  
  23.             for (int i = 0; i < numberOfTournaments; i++)
  24.             {
  25.                 stage = Console.ReadLine();
  26.                
  27.                 if (stage == "F")
  28.                 {
  29.                     points += 1200;
  30.                 }
  31.                 else if (stage == "W")
  32.                 {
  33.                     points += 2000;
  34.                     numberOfWonTournaments++;
  35.                 }
  36.                 else if (stage == "SF")
  37.                 {
  38.                     points += 720;
  39.                 }
  40.             }
  41.             average = (points - startingPoint) / numberOfTournaments;
  42.             percent = ((double)numberOfWonTournaments / numberOfTournaments) * 100;
  43.  
  44.             Console.WriteLine($"Final points: {points}");
  45.             Console.WriteLine($"Average points: {Math.Floor(average)}");
  46.             Console.WriteLine($"{percent:f2}%");
  47.  
  48.         }
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement