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