ss3434

Пекар

Oct 31st, 2019
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. using System;
  2.  
  3. namespace BakingCompetition
  4. {
  5. class BakingCompetition
  6. {
  7. static void Main(string[] args)
  8. {
  9. var kozunak = int.Parse(Console.ReadLine());
  10. string comand = "";
  11. string bakerWinner = "";
  12. int winnerScore = 0;
  13.  
  14. for (int i = 0; i < kozunak; i++)
  15. {
  16. string bakerName = Console.ReadLine();
  17. int currentScore = 0;
  18. while ((comand = Console.ReadLine()) != "Stop")
  19. {
  20. int grade = int.Parse(comand);
  21. currentScore += grade;
  22. }
  23. if (currentScore > winnerScore)
  24. {
  25. bakerWinner = bakerName;
  26. winnerScore = currentScore;
  27. }
  28. }
  29. Console.WriteLine($"winnerBaker {bakerWinner}");
  30. Console.WriteLine($"winnerScore {winnerScore}");
  31. }
  32. }
  33. }
Add Comment
Please, Sign In to add comment