Advertisement
VickSuna

Untitled

Mar 3rd, 2020
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Izpit_20190309_5._2_Tennis_Ranklist
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int numTournaments = int.Parse(Console.ReadLine());
  10. int StartingPoints = int.Parse(Console.ReadLine());
  11.  
  12. int wonPoints = 0;
  13. int titlesWon = 0;
  14.  
  15. for (int i = 1; i <= numTournaments; i++)
  16. {
  17. string etap = Console.ReadLine();
  18.  
  19. if (etap == "W")
  20. {
  21. wonPoints += 2000;
  22. titlesWon++;
  23. }
  24. else if (etap == "F")
  25. {
  26. wonPoints += 1200;
  27. }
  28. else
  29. {
  30. wonPoints += 720;
  31. }
  32. }
  33. double finalPoints = StartingPoints + wonPoints;
  34.  
  35. double averagePoints = Math.Floor(wonPoints * 1.0 / numTournaments);
  36.  
  37. double percentWonTournaments = titlesWon * 1.0 / numTournaments * 100;
  38.  
  39. Console.WriteLine($"Final points: {finalPoints}");
  40. Console.WriteLine($"Average points: {averagePoints}");
  41. Console.WriteLine($"{percentWonTournaments:F2}%");
  42.  
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement