Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace EasterCompetition
- {
- class Program
- {
- static void Main(string[] args)
- {
- int easterBread = int.Parse(Console.ReadLine());
- string baker1 = "";
- int maxNum = 0;
- for (int i = 0; i < easterBread; i++)
- {
- string baker = Console.ReadLine();
- int bakerpoints = 0;
- while (true)
- {
- string points = Console.ReadLine();
- if (points == "Stop")
- {
- if (maxNum < bakerpoints)
- {
- baker1 = baker;
- maxNum = bakerpoints;
- Console.WriteLine($"{baker1} has {maxNum} points.");
- Console.WriteLine($"{baker1} is the new number 1!");
- }
- else
- {
- Console.WriteLine($"{baker} has {bakerpoints} points.");
- }
- break;
- }
- bakerpoints += int.Parse(points);
- }
- }
- Console.WriteLine($"{baker1} won competition with {maxNum} points!");
- }
- }
- }
Add Comment
Please, Sign In to add comment