Advertisement
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 Group_Stage
- {
- class Program
- {
- static void Main(string[] args)
- {
- string nameTeam = Console.ReadLine();
- int numberPlays = int.Parse(Console.ReadLine());
- int countPoints = 0;
- int totalScoredGoals = 0;
- int totalReceivedGoals = 0;
- int playsCount = 0;
- while (numberPlays != playsCount)
- {
- int scoredGoals = int.Parse(Console.ReadLine());
- int receivedGoals = int.Parse(Console.ReadLine());
- if(scoredGoals > receivedGoals)
- {
- countPoints += 3;
- scoredGoals -= receivedGoals;
- totalScoredGoals += scoredGoals;
- }
- else if (scoredGoals == receivedGoals)
- {
- countPoints++;
- }
- else if(scoredGoals < receivedGoals)
- {
- scoredGoals-=receivedGoals;
- totalReceivedGoals += scoredGoals;
- }
- playsCount++;
- }
- if(numberPlays == playsCount)
- {
- if (totalScoredGoals >Math.Abs(totalReceivedGoals) )
- {
- Console.WriteLine($"{nameTeam} has finished the group phase with {countPoints} points.");
- int goalDiff = totalScoredGoals - totalReceivedGoals;
- Console.WriteLine($"Goal difference: {goalDiff}.");
- }
- else if (totalScoredGoals < Math.Abs(totalReceivedGoals))
- {
- Console.WriteLine($"{nameTeam} has been eliminated from the group phase.");
- double diff = totalReceivedGoals - totalScoredGoals;
- Console.WriteLine($"Goal difference: {diff}.");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement