public List <int[]> DoTask() { int cntGuests = relations.GetLength(0); int[] combination = Perm.GetFirstPerm(cntGuests); do { if (CheckRelation(combination)) { result.Add((int[])combination.Clone()); } } while (Perm.GetNextPerm(ref combination)); return(result); }
private void btnStart_Click(object sender, EventArgs e) { btnStart.Enabled = false; dgvRelations.ReadOnly = true; Guests guests = new Guests(relations); List <int[]> list = guests.DoTask(); if (list.Count == 0) { MessageBox.Show("Нет вариантов рассадки"); } else { foreach (var el in list) { txtBoxRes.Text += Perm.PermToString(el) + Environment.NewLine; } } txtBoxCntRes.Text = list.Count + " различных вариантов"; }