Advertisement
akass

Genome

Nov 11th, 2014
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.00 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 Test2
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.             List<string> coll = new List<string>();
  15.             for (int i = 0; i < args.Length; i++)
  16.             { coll.Add(args[i]); }
  17.             Genome gen = new Genome();
  18.             gen.perebor_elementov(coll);
  19.            
  20.         }
  21.     }
  22.     class Genome
  23.     {
  24.  
  25.         public List<string> geni = new List<string>();
  26.         //public Genome(List<string> coll) { geni = coll; }
  27.  
  28.      public void perebor_elementov (List<string> geni)
  29.     {
  30.         for (int i = 0; i < geni.Count; i++)
  31.         { Assembly(geni[i],geni); }
  32.     }
  33.         public string Assembly (string gen ,List<string> geni )
  34.         {
  35.             string result = string.Empty;
  36.            
  37.             //Здесь сравнение элемента с другими и соединение
  38.             for (int j = 0; 0 < geni.Count;j++)
  39.             {
  40.                 if (gen.EndsWith(geni[j].Substring(1)))
  41.                 {
  42.                     gen = string.Concat(gen, geni[j].Substring(1));
  43.                     geni.RemoveAt(j);
  44.                 }
  45.                 else
  46.                 {
  47.                     if (gen.EndsWith(geni[j].Substring(2)))
  48.                     {
  49.                         gen = string.Concat(gen, geni[j].Substring(2));
  50.                         geni.RemoveAt(j);
  51.                     }
  52.                     else
  53.                     {
  54.                         if (gen.EndsWith(geni[j].Substring(1)))
  55.                         {
  56.                             gen = string.Concat(gen, geni[j].Substring(1));
  57.                             geni.RemoveAt(j);
  58.                         }
  59.                         else { result = "не подошел"; return result; }
  60.                     }
  61.                 }
  62.  
  63.                
  64.             }
  65.             return gen;
  66.  
  67.         }
  68.  
  69.     }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement