Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _06._Easter_Competition
- {
- class Program
- {
- static void Main(string[] args)
- {
- int cosunacCount = int.Parse(Console.ReadLine());
- int pointsMax = int.MinValue;
- string bakerWinner = string.Empty;
- int counter = 1;
- while (counter <= cosunacCount)
- {
- int points = 0;
- string nameBaker = Console.ReadLine();
- string evaluation = Console.ReadLine();
- while (evaluation != "Stop")
- {
- points += int.Parse(evaluation);
- evaluation = Console.ReadLine();
- if (pointsMax <= points)
- {
- pointsMax = points;
- bakerWinner = nameBaker;
- }
- Console.WriteLine($"{nameBaker} has {points} points.");
- if (pointsMax == points)
- {
- Console.WriteLine($"{nameBaker} is the new number 1!");
- }
- if (counter == cosunacCount)
- {
- Console.WriteLine($"{bakerWinner} won competition with {pointsMax} points!");
- }
- }
- counter++;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement