Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace Balls
- {
- class Program
- {
- static void Main()
- {
- var colors = new Dictionary<string, int>()
- {
- { "red", 5 }, { "orange", 10 },{ "yellow", 15 },{ "white", 20 }
- };
- var points = new Dictionary<string, int>()
- {
- { "red", 0 }, { "orange", 0 },{ "yellow", 0 },{ "white", 0 }
- };
- int N = int.Parse(Console.ReadLine());
- int others = 0;
- int totalPoints = 0;
- int black = 0;
- for (int i = 0; i < N; i++)
- {
- string input = Console.ReadLine().ToLower();
- if (input == "black")
- {
- totalPoints /= 2;
- black++;
- }
- else if (!colors.ContainsKey(input))
- {
- others++;
- }
- else
- {
- points[input]++;
- totalPoints += colors[input];
- }
- }
- Console.WriteLine($"Total points: {totalPoints}");
- Console.WriteLine($"Points from red balls: {points["red"]}");
- Console.WriteLine($"Points from orange balls: {points["orange"]}");
- Console.WriteLine($"Points from yellow balls: {points["yellow"]}");
- Console.WriteLine($"Points from white balls: {points["white"]}");
- Console.WriteLine($"Other colors picked: {others}");
- Console.WriteLine($"Divides from black balls: {black}");
- }
- }
- }
Add Comment
Please, Sign In to add comment