You own a small cocktail bar with 8 different bottles: - Vodka - Gin - Rum - Whiskey - Tequila - Martini - Mango Juice - Cola You need to come up with the menu for the grand opening tonight. How many different cocktails would you be able to create with your shaker? For this problem, each cocktail may only contain 2 drinks. Also, remember that a drink mixed with itself is not a cocktail.
is 10% Gin with 90% Martini the same Cocktail than 90% Gin with 10% Martini? My guess is ENDLESS possibilities ...
CORRECT!! Well done! The answer is [((n^2 + n) / 2) - n] which is 28. Why? Because a Whiskey-Cola is the same as a Cola-Whiskey. It was based on this kind of logic that I built my new collision detector. Old code: Code: Dim number_of_characters = 256 as Int 'Originally as Boolean (ahahah, thx Informatix)Dim Collision(256, 256) as BooleanFor host = 0 to (number_of_characters - 1) For guest = 0 to (number_of_characters - 1) Collision(host, guest) = CheckCollision(host, guest) NextNext'Number of Collision Checks: 65536 My new method: Code: Dim number_of_characters = 256 as Int 'Originally as Boolean (ahahah, thx Informatix)Dim Collision(256, 256) as BooleanFor host = 0 to (number_of_characters - 1) For guest = host + 1 to (number_of_characters - 1) Collision(host, guest) = CheckCollision(host, guest) Collision(guest, host) = Collision(host, guest) NextNext'Number of Collision Checks: 32640 For more on this subject, Google: Triangular Numbers
actually it's not always the case, some drinks are forbidden to be shaken because the stuff isn't supposed to mix and are floating on top of each other. so if you have whiskey-cola it will taste different than cola-whiskey because you get the other stuff in your mouth first
Probably I'm wrong, but I reached the same correct result applying [n! / (n-k)!] /2 that derives from what in Italian is called "Disposizioni semplici", where "n" are the objects and "k" are the elements put together. Final division accounts for couples like Gin-Rum / Rum-Gin. udg
I think the general formula is n!/[(n-k)!*k!] Where the k! plays the same role as the "2" but with k elements (for k=3 --> k!=3.2=6 --> Gin-Rum-Vodka , Gin-Vodka-Rum, Rum-Gin-Vodka, Rum-Vodka-Gin, Vodka-Rum-Gin, Vodka-Gin-Rum )
R1 over R2 : (in this case 8 over 2) Code: Dim mul As Int = 1For i = 1 To R2 mul = mul * ((R1+1-i)/i)Nextresult = mul