Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _06._Easter_Competition
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int cosunacCount = int.Parse(Console.ReadLine());
  10. int pointsMax = int.MinValue;
  11. string bakerWinner = string.Empty;
  12. int counter = 1;
  13.  
  14. while (counter <= cosunacCount)
  15. {
  16. int points = 0;
  17. string nameBaker = Console.ReadLine();
  18. string evaluation = Console.ReadLine();
  19. while (evaluation != "Stop")
  20. {
  21. points += int.Parse(evaluation);
  22. evaluation = Console.ReadLine();
  23. if (pointsMax <= points)
  24. {
  25. pointsMax = points;
  26. bakerWinner = nameBaker;
  27. }
  28. Console.WriteLine($"{nameBaker} has {points} points.");
  29. if (pointsMax == points)
  30. {
  31. Console.WriteLine($"{nameBaker} is the new number 1!");
  32. }
  33. if (counter == cosunacCount)
  34. {
  35. Console.WriteLine($"{bakerWinner} won competition with {pointsMax} points!");
  36. }
  37. }
  38. counter++;
  39. }
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement