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