Advertisement
Sim0o0na

4. Balls

Mar 12th, 2018
1,161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 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 _4_Balls
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int balls = int.Parse(Console.ReadLine());
  14.  
  15. int points = 0;
  16. int redPoints = 0;
  17. int yellowPoints = 0;
  18. int orangePoints = 0;
  19. int whitePoints = 0;
  20. int blackPoints = 0;
  21. int otherPoints = 0;
  22.  
  23. for (int i = 1; i <= balls; i++)
  24. {
  25. string color = Console.ReadLine();
  26.  
  27. switch (color)
  28. {
  29. case "red":
  30. points += 5;
  31. redPoints++;
  32. break;
  33. case "orange":
  34. points += 10;
  35. orangePoints++;
  36. break;
  37. case "yellow":
  38. points += 15;
  39. yellowPoints++;
  40. break;
  41. case "white":
  42. points += 20;
  43. whitePoints++;
  44. break;
  45. case "black":
  46. points /= 2;
  47. blackPoints++;
  48. break;
  49. default:
  50. otherPoints++;
  51. break;
  52. }
  53.  
  54. }
  55. Console.WriteLine("Total points: {0}", points);
  56. Console.WriteLine("Points from red balls: {0}", redPoints);
  57. Console.WriteLine("Points from orange balls: {0}", orangePoints);
  58. Console.WriteLine("Points from yellow balls: {0}", yellowPoints);
  59. Console.WriteLine("Points from white balls: {0}", whitePoints);
  60. Console.WriteLine("Other colors picked: {0}", otherPoints);
  61. Console.WriteLine("Divides from black balls: {0}", blackPoints);
  62.  
  63. }
  64. }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement