Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp3
- {
- class Program
- {
- static void Main(string[] args)
- {
- var topChef = "";
- var topChefPoints = 0;
- var input = Console.ReadLine();
- var chefs = int.Parse(input);
- for (int i = 0; i < chefs; i++)
- {
- var chef = Console.ReadLine();
- var chefPoints = 0;
- while (true)
- {
- input = Console.ReadLine();
- if (input == "Stop")
- {
- break;
- }
- if (input != "Stop")
- {
- chefPoints += int.Parse(input);
- }
- }
- Console.WriteLine($"{chef} has ${chefPoints} points.");
- if (chefPoints > topChefPoints)
- {
- topChef = chef;
- topChefPoints = chefPoints;
- Console.WriteLine($"{topChef} is new Number 1!");
- }
- }
- Console.WriteLine($"{topChef} won competition with ${topChefPoints} points!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement