Advertisement
Guest User

EasterCompetition

a guest
Apr 21st, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 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 EasterCompetition
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. double EasterBreadNum = double.Parse(Console.ReadLine());
  14.  
  15. string bakerName = string.Empty;
  16. double maxPoints = 0;
  17. string bestBaker = string.Empty;
  18.  
  19. for (int i = 1; i <= EasterBreadNum; i++)
  20. {
  21. bakerName = Console.ReadLine();
  22. string assessment = string.Empty;
  23. double currentPoints = 0;
  24. while (assessment != "Stop")
  25. {
  26. assessment = Console.ReadLine();
  27. if (assessment == "Stop")
  28. {
  29. assessment = string.Empty;
  30. break;
  31. }
  32. currentPoints += double.Parse(assessment);
  33.  
  34. }
  35. Console.WriteLine($"{bakerName} has {currentPoints} points.");
  36. if (currentPoints > maxPoints)
  37. {
  38. maxPoints = currentPoints;
  39. bestBaker = bakerName;
  40. Console.WriteLine($"{bestBaker} is the new number 1!");
  41. }
  42. }
  43. Console.WriteLine($"{bestBaker} won competition with {maxPoints} points!");
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement