Guest User

Untitled

a guest
Apr 24th, 2016
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace _2_Game_of_names
  5. {
  6. class Program
  7. {
  8. static void Main()
  9. {//INPUT:
  10. int countplrs = int.Parse(Console.ReadLine());
  11. string[] players = new string[countplrs];
  12. // BigInteger[] scorePlayer = new BigInteger[countplrs];
  13. int topScore = Int32.MinValue;
  14. string topName = null;
  15. int[] scorePlayer = new int[countplrs];
  16.  
  17. for (int i = 0; i < countplrs; i++)
  18. {
  19. string name = Console.ReadLine();
  20. // BigInteger sumscore = BigInteger.Parse(Console.ReadLine());
  21.  
  22. int sumscore = int.Parse(Console.ReadLine());
  23. for (int letter = 0; letter < name.Length; letter++)
  24. {
  25. int charnmbr = name[letter];
  26. if (charnmbr % 2 == 0)
  27. {
  28. sumscore += charnmbr;
  29. }
  30. else
  31. {
  32. sumscore -= charnmbr;
  33. }
  34. }
  35. scorePlayer[i] = sumscore;
  36. players[i] = name;
  37. if (sumscore > topScore)
  38. {
  39. topScore = sumscore;
  40. topName = name;
  41. }
  42. }
  43.  
  44.  
  45.  
  46. //OUTPUT:
  47. Console.WriteLine("The winner is {0} - {1} points"
  48. , topScore, topName);
  49. }
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment