-
-
Save ungood/4331176 to your computer and use it in GitHub Desktop.
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
// Store a deck in a bit array by the following algorithm: | |
// value := pick[0]; | |
// value = value * 51 + second pick | |
// value = value * 50 + third pick | |
// .. | |
// value = value * 1 + 52nd pick | |
// The first pick is pick[0] | |
BigInt StoreDeck(params int[] picks) { | |
BigInt value = pick[0]; | |
for(int i = 1; i < picks.Length; i++) { | |
value *= (picks.Length - i) + 1; | |
value += picks[i]; | |
} | |
return value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment