Advertisement
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 numberOfCozunak = int.Parse(Console.ReadLine());
- string gradeAsString = string.Empty;
- string topShef = string.Empty;
- int maxChefGrades = int.MinValue;
- for (int i = 1; i <= numberOfCozunak; i++)
- {
- string nameOfChef = Console.ReadLine();
- gradeAsString = Console.ReadLine();
- int sumGrades = 0;
- while (gradeAsString != "Stop")
- {
- int grade = int.Parse(gradeAsString);
- if (grade <= 0 || grade > 10)
- {
- gradeAsString = Console.ReadLine();
- continue;
- }
- sumGrades += grade;
- gradeAsString = Console.ReadLine();
- }
- Console.WriteLine($"{nameOfChef} has {sumGrades} points.");
- if (sumGrades > maxChefGrades)
- {
- maxChefGrades = sumGrades;
- topShef = nameOfChef;
- Console.WriteLine($"{topShef} is the new number 1!");
- }
- }
- Console.WriteLine($"{topShef} won competition with {maxChefGrades} points!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement