Created
March 15, 2024 09:07
-
-
Save mormegil-cz/b9ff704696061facb9d451dd8e121f31 to your computer and use it in GitHub Desktop.
Jasnovidec@Okoun
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
for (int kol = 2; kol < 15; ++kol) | |
{ | |
Console.WriteLine("{0}: {1}", kol, Enumerable.Range(0, 1 << kol).Select(i => Check(Enumerable.Range(0, kol).Select(b => (i & (1 << b)) == 0 ? 0 : 1).ToList())).Min()); | |
} | |
} | |
static int Check(List<int> krupier) => | |
Enumerable.Range(0, 2).Select(rada => | |
{ | |
var pocet = krupier.Count; | |
var diktatu = Enumerable.Range(1, pocet -1).Count(k => krupier[k] == rada); | |
return Enumerable.Range(1, pocet - diktatu - 1).Count(k => krupier[k] == rada) + diktatu; | |
}).Max(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment