Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _04._Best_Player
- {
- class Program
- {
- static void Main(string[] args)
- {
- string name = Console.ReadLine();
- int numberOfGames = int.Parse(Console.ReadLine());
- int counter = 0;
- int goalsIn = 0;
- int goalsOut = 0;
- int points = 0;
- int totalGoalsOut = 0;
- int totalGoalsIn = 0;
- while (counter < numberOfGames)
- {
- goalsOut = int.Parse(Console.ReadLine());
- goalsIn = int.Parse(Console.ReadLine());
- if (goalsOut > goalsIn)
- {
- points += 3;
- }
- else if (goalsOut==goalsIn)
- {
- points += 1;
- }
- totalGoalsOut += goalsOut;
- totalGoalsIn += goalsIn;
- counter++;
- }
- if (totalGoalsOut >= totalGoalsIn)
- {
- Console.WriteLine($"{name} has finished the group phase with {points} points.");
- Console.WriteLine($"Goal difference: {totalGoalsOut - totalGoalsIn}.");
- }
- else if (totalGoalsOut < totalGoalsIn)
- {
- Console.WriteLine($"{name} has been eliminated from the group phase.");
- Console.WriteLine($"Goal difference: {totalGoalsOut - totalGoalsIn}.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement