Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Test2
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<string> coll = new List<string>();
- for (int i = 0; i < args.Length; i++)
- { coll.Add(args[i]); }
- Genome gen = new Genome();
- gen.perebor_elementov(coll);
- }
- }
- class Genome
- {
- public List<string> geni = new List<string>();
- //public Genome(List<string> coll) { geni = coll; }
- public void perebor_elementov (List<string> geni)
- {
- for (int i = 0; i < geni.Count; i++)
- { Assembly(geni[i],geni); }
- }
- public string Assembly (string gen ,List<string> geni )
- {
- string result = string.Empty;
- //Здесь сравнение элемента с другими и соединение
- for (int j = 0; 0 < geni.Count;j++)
- {
- if (gen.EndsWith(geni[j].Substring(1)))
- {
- gen = string.Concat(gen, geni[j].Substring(1));
- geni.RemoveAt(j);
- }
- else
- {
- if (gen.EndsWith(geni[j].Substring(2)))
- {
- gen = string.Concat(gen, geni[j].Substring(2));
- geni.RemoveAt(j);
- }
- else
- {
- if (gen.EndsWith(geni[j].Substring(1)))
- {
- gen = string.Concat(gen, geni[j].Substring(1));
- geni.RemoveAt(j);
- }
- else { result = "не подошел"; return result; }
- }
- }
- }
- return gen;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement