Advertisement
ss3434

Pekar

Oct 31st, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 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 Задача_6.Великденски_конкурс
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13.  
  14. var numKozunak = int.Parse(Console.ReadLine());
  15. int max = 0;
  16. string winer = "";
  17. for (int i = 0; i < numKozunak; i++)
  18. {
  19. string pekar = Console.ReadLine();
  20. string comand= Console.ReadLine();
  21. int sum = 0;
  22. while (comand!="Stop")
  23. {
  24. int ocenka = int.Parse(comand);
  25. sum += ocenka;
  26. comand = Console.ReadLine();
  27. }
  28. Console.WriteLine($"{pekar} has {sum} points.");
  29. if (sum>max)
  30. {
  31. max = sum;
  32. winer = pekar;
  33. Console.WriteLine($"{pekar} is the new number 1!");
  34. }
  35. }
  36. Console.WriteLine($"{winer} won competition with {max} points!");
  37. }
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement