Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _6.EasternCompetition
- {
- class Program
- {
- static void Main(string[] args)
- {
- int EasterBreads = int.Parse(Console.ReadLine());
- int tempPoints = 0;
- int currentPoints = 0;
- int maxPoints =currentPoints;
- string bestChefName = string.Empty;
- string chefName = string.Empty;
- for (int i = 1; i <= EasterBreads; i++)
- {
- chefName = Console.ReadLine();
- string input = Console.ReadLine();
- while (input!="Stop")
- {
- currentPoints = int.Parse(input);
- tempPoints += currentPoints;
- input = Console.ReadLine();
- }
- Console.WriteLine($"{chefName} has {tempPoints} points.");
- if (maxPoints<tempPoints)
- {
- Console.WriteLine($"{chefName} is the new number 1!");
- maxPoints = tempPoints;
- bestChefName = chefName;
- }
- tempPoints = 0;
- }
- Console.WriteLine($"{bestChefName} won competition with {maxPoints} points!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment