Skip to content

Instantly share code, notes, and snippets.

@sguzunov
Created March 13, 2018 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sguzunov/1d175eb665aeb3e1894f7b0acd7d9fa5 to your computer and use it in GitHub Desktop.
Save sguzunov/1d175eb665aeb3e1894f7b0acd7d9fa5 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Balls
{
class Program
{
static void Main(string[] args)
{
int n = int.Parse(Console.ReadLine());
int redBalls = 0;
int orangeBalls = 0;
int yellowBalls = 0;
int whiteBalls = 0;
int blackBalls = 0;
int othersBalls = 0;
int total = 0;
for (int i = 0; i < n; i++)
{
string ball = Console.ReadLine();
if (ball == "red")
{
redBalls++;
total += 5;
}
else if (ball == "orange")
{
orangeBalls++;
total += 10;
}
else if (ball == "yellow")
{
yellowBalls++;
total += 15;
}
else if (ball == "white")
{
whiteBalls++;
total += 20;
}
else if (ball == "black")
{
blackBalls++;
total /= 2;
}
else
{
othersBalls++;
}
}
Console.WriteLine($"Total points: {total}");
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: {othersBalls}");
Console.WriteLine($"Divides from black balls: {blackBalls}");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment