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