Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace GameOfNames
- {
- class Program
- {
- public static void Main(string[] args)
- {
- int countOfPlayers = int.Parse(Console.ReadLine());
- int[] total = new int[countOfPlayers];
- int[] sum = new int[countOfPlayers];
- string[] nameOfPlayers = new string[countOfPlayers];
- int[] score = new int[countOfPlayers];
- int max = 0;
- int possition = 0;
- for(var i = 0; i < countOfPlayers; i++)
- {
- nameOfPlayers[i] = Console.ReadLine();
- score[i] = int.Parse(Console.ReadLine());
- foreach(var items in nameOfPlayers[i])
- {
- if((int)items % 2 == 0)
- {
- sum[i] += (int)items;
- }
- if((int)items % 2 != 0)
- {
- sum[i] -= (int)items;
- }
- }
- total[i] = sum[i] + score[i];
- max = total.Max();
- possition = Array.IndexOf(total, max);
- }
- Console.WriteLine("The winner is {0} - {1} points", nameOfPlayers[possition], max);
- Console.Write("Press any key to continue . . . ");
- Console.ReadKey(true);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement