Advertisement
Lusien_Lashans

poisk putei

Jun 27th, 2017
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.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 ConsoleApplication4
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var lolkek = new[] { "AB", "AE", "AF", "BF", "EF", "BE", "BC", "FC", "FD", "CD" };
  14.             var azazaz = new[] { 'A','B','C','D','E','F'};
  15.             var dictionary = new Dictionary<char, int>();
  16.             foreach (var bukva in azazaz)
  17.             {
  18.                 dictionary.Add(bukva,0);
  19.             }
  20.             dictionary['A'] = 1;
  21.             for (int i = 0; i < lolkek.Length; i++)
  22.             {
  23.                 foreach (var bukva in azazaz)
  24.                 {
  25.                     if (bukva == lolkek[i][0])
  26.                     {
  27.                         //dictionary[bukva]++;
  28.                         dictionary[lolkek[i][1]] += dictionary[bukva];
  29.                     }
  30.                 }
  31.             }
  32.             Console.WriteLine(dictionary['D']);
  33.  
  34.  
  35.         }
  36.  
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement