Advertisement
Guest User

04. Balls

a guest
Jul 15th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _04.Balls
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int ballsCount = int.Parse(Console.ReadLine());
  10.  
  11.  
  12. int points = 0;
  13.  
  14. int redBallsCounter = 0;
  15. int orangeBallsCounter = 0;
  16. int yellowBallsCounter = 0;
  17. int whiteBallsCounter = 0;
  18. int blackBallsCounter = 0;
  19. int otherColorsBallsCounter = 0;
  20. for (int i = 1; i <= ballsCount; i++)
  21. {
  22. string currentColor = Console.ReadLine();
  23. if (currentColor == "red")
  24. {
  25. points += 5;
  26. redBallsCounter++;
  27. }
  28. else if (currentColor == "orange")
  29. {
  30. points += 10;
  31. orangeBallsCounter++;
  32. }
  33. else if (currentColor == "yellow")
  34. {
  35. points += 15;
  36. yellowBallsCounter++;
  37. }
  38. else if (currentColor == "white")
  39. {
  40. points += 20;
  41. whiteBallsCounter++;
  42. }
  43. else if (currentColor == "black")
  44. {
  45. points /= 2;
  46. blackBallsCounter++;
  47. }
  48. else {
  49. otherColorsBallsCounter++;
  50. }
  51. }
  52. Console.WriteLine($"Total points: {points}");
  53. Console.WriteLine($"Points from red balls: {redBallsCounter}");
  54. Console.WriteLine($"Points from orange balls: {orangeBallsCounter}");
  55. Console.WriteLine($"Points from yellow balls: {yellowBallsCounter}");
  56. Console.WriteLine($"Points from white balls: {whiteBallsCounter}");
  57. Console.WriteLine($"Other colors picked: {otherColorsBallsCounter}");
  58. Console.WriteLine($"Divides from black balls: {blackBallsCounter}");
  59. }
  60. }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement