Advertisement
spasnikolov131

Untitled

Jun 16th, 2022
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. using System;
  2. using System.Linq.Expressions;
  3.  
  4. namespace Add_Bags
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. int n = int.Parse(Console.ReadLine());
  11.  
  12. int totalPoints = 0;
  13. int red = 0;
  14. int orange = 0;
  15. int yellow = 0;
  16. int white = 0;
  17. int black = 0;
  18. int others = 0;
  19.  
  20. for (int i = totalPoints; i < n; i++)
  21. {
  22. string colours = Console.ReadLine();
  23.  
  24. switch (colours)
  25. {
  26. case "red":
  27. totalPoints += 5;
  28. red++;
  29. break;
  30. case "orange":
  31. totalPoints += 10;
  32. orange++;
  33. break;
  34. case "yellow":
  35. yellow++;
  36. break;
  37. case "white":
  38. totalPoints += 20;
  39. white++;
  40. break;
  41. case "black":
  42. totalPoints /= 2;
  43. black++;
  44. break;
  45.  
  46. default:
  47. others++;
  48. break;
  49.  
  50. }
  51. }
  52.  
  53. Console.WriteLine($"Total points: {totalPoints}");
  54. Console.WriteLine($"Red balls: {red}");
  55. Console.WriteLine($"Orange balls: {orange}");
  56. Console.WriteLine($"Yellow balls: {yellow}");
  57. Console.WriteLine($"White balls: {white}");
  58. Console.WriteLine($"Other colors picked: {others}");
  59. Console.WriteLine($"Divides from black balls: {black}");
  60.  
  61. }
  62. }
  63. }
  64.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement