Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp7
- {
- class Program
- {
- static void Main(string[] args)
- {
- string name = Console.ReadLine();
- int matches = int.Parse(Console.ReadLine());
- int W = 0;
- int L = 0;
- int D = 0;
- int sum = 0;
- for(int i = 0;i < matches; i++)
- {
- char result = char.Parse(Console.ReadLine());
- if(result == 'W')
- {
- W++;
- }
- else if (result == 'L')
- {
- L++;
- }
- else if (result == 'D')
- {
- D++;
- }
- sum = W * 3 + D + L * 0;
- }
- double percentage = (W * 1.0/ matches * 100);
- if (matches <= 0)
- {
- Console.WriteLine($"{name} hasn't played any games during this season.");
- }
- else if(matches > 0)
- {
- Console.WriteLine($"{name} has won {sum} points during this season.");
- Console.WriteLine("Total stats:");
- Console.WriteLine($"## W: {W}");
- Console.WriteLine($"## D: {D}");
- Console.WriteLine($"## L: {L}");
- Console.WriteLine($"Win rate: {percentage:f2}%");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement