Advertisement
Bubeto

Untitled

Feb 26th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Group_Stage
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string nameTeam = Console.ReadLine();
  14. int numberPlays = int.Parse(Console.ReadLine());
  15. int countPoints = 0;
  16. int totalScoredGoals = 0;
  17. int totalReceivedGoals = 0;
  18. int playsCount = 0;
  19.  
  20. while (numberPlays != playsCount)
  21. {
  22. int scoredGoals = int.Parse(Console.ReadLine());
  23. int receivedGoals = int.Parse(Console.ReadLine());
  24.  
  25. if(scoredGoals > receivedGoals)
  26. {
  27. countPoints += 3;
  28. scoredGoals -= receivedGoals;
  29. totalScoredGoals += scoredGoals;
  30. }
  31. else if (scoredGoals == receivedGoals)
  32. {
  33. countPoints++;
  34.  
  35.  
  36. }
  37. else if(scoredGoals < receivedGoals)
  38. {
  39. scoredGoals-=receivedGoals;
  40. totalReceivedGoals += scoredGoals;
  41.  
  42. }
  43.  
  44. playsCount++;
  45.  
  46. }
  47.  
  48. if(numberPlays == playsCount)
  49. {
  50. if (totalScoredGoals >Math.Abs(totalReceivedGoals) )
  51. {
  52. Console.WriteLine($"{nameTeam} has finished the group phase with {countPoints} points.");
  53. int goalDiff = totalScoredGoals - totalReceivedGoals;
  54. Console.WriteLine($"Goal difference: {goalDiff}.");
  55. }
  56. else if (totalScoredGoals < Math.Abs(totalReceivedGoals))
  57. {
  58. Console.WriteLine($"{nameTeam} has been eliminated from the group phase.");
  59.  
  60. double diff = totalReceivedGoals - totalScoredGoals;
  61. Console.WriteLine($"Goal difference: {diff}.");
  62.  
  63. }
  64. }
  65.  
  66.  
  67.  
  68. }
  69. }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement