SHARE
TWEET

Untitled

aggressiveviking Feb 14th, 2020 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace P06_EasterCompetition
  4. {
  5.     class P06_EasterCompetition
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int count = int.Parse(Console.ReadLine());
  10.             string bestBakerName = "";
  11.             int bestBakerPoints = -1;
  12.  
  13.             for (int i = 0; i < count; i++)
  14.             {
  15.                 string bakerName = Console.ReadLine();
  16.                 int points = 0;
  17.                 string command = Console.ReadLine();
  18.  
  19.                 while ("Stop" != command)
  20.                 {
  21.                     points += int.Parse(command);
  22.                     command = Console.ReadLine();
  23.                 }
  24.  
  25.                 Console.WriteLine($"{bakerName} has {points} points.");
  26.                 if (points > bestBakerPoints)
  27.                 {
  28.                     bestBakerName = bakerName;
  29.                     bestBakerPoints = points;
  30.                     Console.WriteLine($"{bakerName} is the new number 1!");
  31.                 }
  32.             }
  33.             Console.WriteLine($"{bestBakerName} won competition with {bestBakerPoints} points!");
  34.         }
  35.     }
  36. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top