Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _04.GroupStage
- {
- class Program
- {
- static void Main(string[] args)
- {
- string teamName = Console.ReadLine();
- int matchesNum = int.Parse(Console.ReadLine());
- int goalsDiff = 0;
- int score = 0;
- int totalScoredGoals = 0;
- int totalReceivedGoals = 0;
- for (int matches = 1; matches <= matchesNum; matches++)
- {
- int scoredGoals = int.Parse(Console.ReadLine());
- int receivedGoals = int.Parse(Console.ReadLine());
- totalScoredGoals += scoredGoals;
- totalReceivedGoals += receivedGoals;
- if (scoredGoals > receivedGoals)
- {
- score += 3;
- }
- else
- {
- if (scoredGoals == receivedGoals)
- {
- score++;
- }
- }
- }
- goalsDiff = totalScoredGoals - totalReceivedGoals;
- if (totalScoredGoals >= totalReceivedGoals)
- {
- Console.WriteLine($"{teamName} has finished the group phase with {score} points.");
- Console.WriteLine($"Goal difference: {goalsDiff}.");
- }
- else
- {
- Console.WriteLine($"{teamName} has been eliminated from the group phase.");
- Console.WriteLine($"Goal difference: {goalsDiff}.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement