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 _02.Exam2
- {
- class Program
- {
- static void Main(string[] args)
- {
- int numberOfPlayers = int.Parse(Console.ReadLine());
- string name = "";
- int initialscore = 0;
- int score = 0;
- int maxScore = int.MinValue;
- List<int> scoreContent = new List<int>();
- List<string> nameContent = new List<string>();
- string winner = "";
- for (int i = 0; i < numberOfPlayers; i++)
- {
- name = Console.ReadLine();
- initialscore = int.Parse(Console.ReadLine());
- foreach (var ch in name)
- {
- if (ch % 2 == 0)
- {
- score += ch;
- }
- else
- {
- score -= ch;
- }
- }
- if (score + initialscore > maxScore)
- {
- maxScore = score+initialscore;
- winner = name;
- }
- scoreContent.Add(initialscore + score);
- score = 0;
- }
- Console.WriteLine("The winner is {0} - {1} points",winner,maxScore);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement