Advertisement
IordanRujinov

Balls

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