Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace P06_EasterCompetition
- {
- class P06_EasterCompetition
- {
- static void Main(string[] args)
- {
- int count = int.Parse(Console.ReadLine());
- string bestBakerName = "";
- int bestBakerPoints = -1;
- for (int i = 0; i < count; i++)
- {
- string bakerName = Console.ReadLine();
- int points = 0;
- string command = Console.ReadLine();
- while ("Stop" != command)
- {
- points += int.Parse(command);
- command = Console.ReadLine();
- }
- Console.WriteLine($"{bakerName} has {points} points.");
- if (points > bestBakerPoints)
- {
- bestBakerName = bakerName;
- bestBakerPoints = points;
- Console.WriteLine($"{bakerName} is the new number 1!");
- }
- }
- Console.WriteLine($"{bestBakerName} won competition with {bestBakerPoints} points!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement