Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace _2_Game_of_names
- {
- class Program
- {
- static void Main()
- {//INPUT:
- int countplrs = int.Parse(Console.ReadLine());
- string[] players = new string[countplrs];
- // BigInteger[] scorePlayer = new BigInteger[countplrs];
- int topScore = Int32.MinValue;
- string topName = null;
- int[] scorePlayer = new int[countplrs];
- for (int i = 0; i < countplrs; i++)
- {
- string name = Console.ReadLine();
- // BigInteger sumscore = BigInteger.Parse(Console.ReadLine());
- int sumscore = int.Parse(Console.ReadLine());
- for (int letter = 0; letter < name.Length; letter++)
- {
- int charnmbr = name[letter];
- if (charnmbr % 2 == 0)
- {
- sumscore += charnmbr;
- }
- else
- {
- sumscore -= charnmbr;
- }
- }
- scorePlayer[i] = sumscore;
- players[i] = name;
- if (sumscore > topScore)
- {
- topScore = sumscore;
- topName = name;
- }
- }
- //OUTPUT:
- Console.WriteLine("The winner is {0} - {1} points"
- , topScore, topName);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment