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;
- class GameOfNames
- {
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- var tempName = "";
- long maxSum = long.MinValue;
- for (int i = 0; i < n; i++)
- {
- string name = Console.ReadLine();
- long points = long.Parse(Console.ReadLine());
- for (int j = 0; j < name.Length; j++)
- {
- if ((int)name[j] % 2 == 0)
- {
- points += (int)name[j];
- }
- else
- {
- points -= (int)name[j];
- }
- }
- if (maxSum < points)
- {
- tempName = name;
- maxSum = points;
- }
- }
- Console.WriteLine("The winner is {0} - {1} points", tempName, maxSum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement