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