Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp3
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. var topChef = "";
  10. var topChefPoints = 0;
  11.  
  12. var input = Console.ReadLine();
  13. var chefs = int.Parse(input);
  14. for (int i = 0; i < chefs; i++)
  15. {
  16. var chef = Console.ReadLine();
  17. var chefPoints = 0;
  18.  
  19. while (true)
  20. {
  21. input = Console.ReadLine();
  22. if (input == "Stop")
  23. {
  24.  
  25. break;
  26. }
  27.  
  28. if (input != "Stop")
  29. {
  30. chefPoints += int.Parse(input);
  31. }
  32. }
  33. Console.WriteLine($"{chef} has ${chefPoints} points.");
  34. if (chefPoints > topChefPoints)
  35. {
  36. topChef = chef;
  37. topChefPoints = chefPoints;
  38. Console.WriteLine($"{topChef} is new Number 1!");
  39. }
  40. }
  41.  
  42. Console.WriteLine($"{topChef} won competition with ${topChefPoints} points!");
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement