Advertisement
Yanislav29

Untitled

Nov 28th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp7
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string name = Console.ReadLine();
  14. string maxName = string.Empty;
  15. int maxPoints = 0;
  16. string winner = " ";
  17.  
  18. while(name != "Stop")
  19. {
  20. int points = 0;
  21.  
  22. for(int i = 0; i < name.Length; i++)
  23. {
  24.  
  25. int number = int.Parse(Console.ReadLine());
  26. if(number == name[i])
  27. {
  28. points += 10;
  29. }
  30. else
  31. {
  32. points += 2;
  33. }
  34. if(points >= maxPoints)
  35. {
  36. maxPoints = points;
  37. winner = name;
  38. }
  39.  
  40.  
  41.  
  42.  
  43.  
  44. }
  45. name = Console.ReadLine();
  46. }
  47. Console.WriteLine($"The winner is {winner} with {maxPoints} points!");
  48. }
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement