Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _04._Group_Stage
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string name = Console.ReadLine();
  10. int playedGames = int.Parse(Console.ReadLine());
  11. int goalsGetInTotal = 0;
  12. int goalsRecieveTotal = 0;
  13. int points = 0;
  14.  
  15. for (int i = 0; i < playedGames; i++)
  16. {
  17. int goalsGetIn = int.Parse(Console.ReadLine());
  18. int goalsRecieve = int.Parse(Console.ReadLine());
  19.  
  20. if (goalsGetIn > goalsRecieve)
  21. {
  22. points += 3;
  23. }
  24. else if (goalsRecieve > goalsGetIn)
  25. {
  26. points += 0;
  27. }
  28. else if (goalsGetIn == goalsRecieve)
  29. {
  30. points += 1;
  31. }
  32. goalsGetInTotal += goalsGetIn;
  33. goalsRecieveTotal += goalsRecieve;
  34. }
  35. int diff = goalsGetInTotal - goalsRecieveTotal;
  36. if (goalsGetInTotal >= goalsRecieveTotal)
  37. {
  38. Console.WriteLine($"{name} has finished the group phase with {points} points.");
  39. Console.WriteLine($"Goal difference: {diff}.");
  40. }
  41. else
  42. {
  43. Console.WriteLine($"{name} has been eliminated from the group phase.");
  44. Console.WriteLine($"Goal difference: {diff}.");
  45. }
  46.  
  47. }
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement