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 Names
- {
- class Program
- {
- static void Main(string[] args)
- {
- int playersCount = int.Parse(Console.ReadLine());
- string winner = string.Empty;
- int maxScore = int.MinValue;
- for (int i = 0; i < playersCount; i++)
- {
- string playerName = Console.ReadLine();
- int initialScore = int.Parse(Console.ReadLine());
- for (int j = 0; j < playerName.Length; j++)
- {
- if (playerName[j] % 2 == 0)
- {
- initialScore += playerName[j];
- }
- else
- {
- initialScore -= playerName[j];
- }
- }
- if (initialScore > maxScore)
- {
- maxScore = initialScore;
- winner = playerName;
- }
- }
- Console.WriteLine("The winner is {0} - {1} points", winner, maxScore);
- }
- }
- }
Add Comment
Please, Sign In to add comment