private string reverseCombination() { var reserveCombination = new CSN(n, data).generateCombination(k, (int)CSN()); string s = "{ "; for (int i = 0; i < k; ++i) { s += reserveCombination[i].ToString("00") + " "; } s += "}"; return(s); }
public static void process() { StreamReader rd = new StreamReader(@"..\..\..\lotofacil-results.csv"); string linha = null; string[] colunas = null; while ((linha = rd.ReadLine()) != null) { colunas = linha.Split(';'); if (char.IsDigit(colunas[0][0]) == false) { continue; } var drawingNumber = int.Parse(colunas[0]); var result = new Result(); result.drawingNumber = drawingNumber; for (int i = 1; i < colunas.Length; i++) { result.numbers.Add(int.Parse(colunas[i])); } result.numbers.Sort(); var csn = new CSN(25, result.numbers.ToArray()); result.CSN = csn.calculate(); results.Add(drawingNumber, result); } rd.Close(); using (var writer = new StreamWriter(@"..\..\..\results-csn.csv")) { foreach (var item in results.OrderBy(r => r.Key)) { var result = $"{item.Key};{string.Join(";", item.Value.numbers)};{item.Value.CSN}\n"; writer.Write(result); } } }