简体   繁体   中英

A seemingly simple yet hard combinatorics problem

No matter how much I think about this, I cannot get the answer... The rules are fairly simple:

using only lowercase letters, from the English alphabet (no numbers or special characters allowed) tell me how many passwords of five characters can be created if there MUST be three or more vocals in the actual password.

I believe the right approach is to calculate the total amount of passwords you can create with five digits and then subtract from it those that do not fulfill the vocal requirements. Yet I have hit this mindblock and cannot seem to figure out how many passwords I need to discard. If you could lend me a hand it would be much appreciated!

If I understood well your problem:

  • We count the total passwords: one letter for each position 26 * 26 * 26 * 26 * 26 = 26 5
  • Then, we calculate how many passwords we can create with three vowels: 5 C 3 * 5 3 * 21 2 (the vowels can be in 3 out of 5 positions, the rest will be 21 consonants to choose in the two remaining positions)
  • Now we calculate how many passwords we can create with four wovels: 5 C 4 * 5 4 * 21 (similar explanation as above)
  • We can as well have 5 vowels, don't we? So 5^5 (similar to the first point)

We then subtract all these to the total, so: 26 5 - 5 C 3 * 5 3 * 21 2 - 5 C 4 * 5 4 * 21 - 5 5

Edit right before going to bed: in this was we count the numbers of passwords which do not respect our standard of having at least three vowels. Since we want that, we just sum all the combinations without subtracting from the total.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM