Advertisement
dimanou_04

Untitled

Feb 10th, 2022
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 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 n = int.Parse(Console.ReadLine());
  10.  
  11. int points = 0;
  12.  
  13. int redBall = 0;
  14. int orangeBall = 0;
  15. int yellowBall = 0;
  16. int whiteBall = 0;
  17. double blackBall = 0;
  18. int otherColorBall = 0;
  19.  
  20. for (int i = 1; i <= n; i++)
  21. {
  22. string color = Console.ReadLine().ToLower();
  23.  
  24. if (color == "red")
  25. {
  26. points += 5;
  27. redBall++;
  28. }
  29. else if (color == "orange")
  30. {
  31. points += 10;
  32. orangeBall++;
  33. }
  34. else if (color == "yellow")
  35. {
  36. points += 15;
  37. yellowBall++;
  38. }
  39. else if (color == "white")
  40. {
  41. points += 20;
  42. whiteBall++;
  43. }
  44. else if (color == "black")
  45. {
  46. points /= 2; // MATH.FLOOR IN CW!!!!!
  47. blackBall++;
  48. }
  49. else
  50. {
  51. otherColorBall++;
  52.  
  53. }
  54.  
  55.  
  56. Console.WriteLine($"Total points: {points}");
  57. Console.WriteLine($"Red balls: {redBall}");
  58. Console.WriteLine($"Orange balls: {orangeBall}");
  59. Console.WriteLine($"Yellow balls: {yellowBall}");
  60. Console.WriteLine($"White balls: {whiteBall}");
  61. Console.WriteLine($"Other colors picked: {otherColorBall}");
  62. Console.WriteLine($"Divides from black balls: {Math.Floor(blackBall)}");
  63.  
  64.  
  65.  
  66.  
  67.  
  68. }
  69. }
  70. }
  71. }
  72.  
  73.  
  74.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement