using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
static List<List<int>> ganyan = new List<List<int>>()
static List<List<int>> ganyanANDplase = new List<List<int>>()
static List<List<int>> cifte = new List<List<int>>()
static List<List<int>> ucluGanyan = new List<List<int>>()
static List<List<int>> dortluGanyan = new List<List<int>>()
static List<int> ikiliVirgullu = new() { 3, 4, 5 };
static List<int> ucluVirgullu = new() { 1, 2, 3, 5, 7, 9 };
static List<int> tabelaVirgullu = new() { 1, 2, 3, 5, 7, 9 };
static List<int> besliVirgullu = new() { 1, 2, 3, 5, 7, 9 };
static List<List<int>> plaseIkili = new List<List<int>>()
static List<List<int>> siraliIkili = new List<List<int>>()
static List<List<int>> siraliUclu = new List<List<int>>()
static List<List<int>> tabelaBahis = new List<List<int>>()
static List<List<int>> siraliBesli = new List<List<int>>()
new(){1,2,3,4,5,6,7,8,9,10,11,12,13},
new(){1,2,3,4,5,6,7,8,9,10,11,12,13},
new(){1,2,3,4,5,6,7,8,9,10,11,12,13},
new(){1,2,3,4,5,6,7,8,9,10,11,12,13},
new(){1,2,3,4,5,6,7,8,9,10,11,12,13},
private static Object outputLock = new Object();
static void Main(string[] args)
var result1 = CalSirali(siraliUclu, true);
Console.WriteLine(result1);
Stopwatch watch = new Stopwatch();
return watch.ElapsedMilliseconds;
static int CalBasic(List<List<int>> choiceMatris)
for (int i = 0; i < choiceMatris.Count; i++)
result *= choiceMatris[i].Count;
static int CalVirgullu(List<int> choices, int n, bool isKomple = false)
return Combination(choices.Count, n) * (isKomple ? Factorial(n) : 1);
static int CalSirali(List<List<int>> choiceMatris, bool isKomple = false)
return MultiplyArrRec(choiceMatris, 0, null, isKomple);
static int MultiplyArrRec(List<List<int>> choiceMatris, int i, List<string> multiplyArr, bool isKomple = false)
if (i >= choiceMatris.Count)
var c = multiplyArr.Distinct().Count();
return c * Factorial(choiceMatris.Count);
return multiplyArr.Count;
List<string> mulResult = new List<string>();
mulResult = choiceMatris[0].Select(s => s.ToString()).ToList();
foreach (var itemAll in multiplyArr)
foreach (var item in choiceMatris[i])
var carr = itemAll.Split(",").Select(s => int.Parse(s)).ToList();
if (!carr.Contains(item))
mulResult.Add(String.Join(",", carr));
return MultiplyArrRec(choiceMatris, i + 1, mulResult, isKomple);
static int Factorial(int n)
return Enumerable.Range(1, n).Aggregate(1, (p, item) => p * item);
static int Combination(int n, int r)
return Factorial(n) / (Factorial(n - r) * Factorial(r));