Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace exam_4
- {
- class Program
- {
- static void Main(string[] args)
- {
- int countBalls = int.Parse(Console.ReadLine());
- int redBalls = 0;
- int orangeBalls = 0;
- int yellowBalls = 0;
- int whiteBalls = 0;
- int blackBalls = 0;
- int balls = 0;
- int other = 0;
- for (int i = 1; i <= countBalls; i++)
- {
- string colors = Console.ReadLine();
- if (colors=="red")
- {
- redBalls ++;
- balls +=5;
- }
- else if (colors == "orange")
- {
- orangeBalls++;
- balls += 10;
- }
- else if (colors == "yellow")
- {
- yellowBalls ++;
- balls += 15;
- }
- else if (colors == "white")
- {
- whiteBalls ++;
- balls += 20;
- }
- else if (colors=="black")
- {
- blackBalls++;
- balls /= 2;
- }
- if (colors!="black"&&colors!="orange"&&colors!="yellow" && colors != "red" && colors != "white")
- {
- other++;
- continue;
- }
- }
- Console.WriteLine($"Total points: {balls}");
- Console.WriteLine($"Points from red balls: {redBalls}");
- Console.WriteLine($"Points from orange balls: {orangeBalls}");
- Console.WriteLine($"Points from yellow balls: {yellowBalls}");
- Console.WriteLine($"Points from white balls: {whiteBalls}");
- Console.WriteLine($"Other colors picked: {other}");
- Console.WriteLine($"Divides from black balls: {blackBalls}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment