+0  
 
+1
504
1
avatar

Hello Max! Can you please take a look at this question and see if you can arrive at the same answer (2,111) using combination and permutations?   https://web2.0calc.com/questions/set-theory

Thanks alot.

 Jun 14, 2020
 #1
avatar+9519 
0

Sorry, I am bad at combinatorics, but same as that Guest who answered your question, I wrote a program to verify Guest's answer, and it's correct. Here's my source code in C++:

 

#include
using namespace std;
string s = "122333444455555";
int main(){
    set se;
    do{
        se.insert(s.substr(0, 5));
    } while (next_permutation(s.begin(), s.end()));
    cout << se.size() << endl;
}

You can run it yourself on a suitable IDE(Integrated Development Environment) for C++, or just find one to run on by searching "online C++ IDE" on Google. You will see that the result is 2111.

 

Edit: I don't know why a part of my code keep disappearing. But the first line is \(\#\text{include}<\text{bits/stdc++.h}>\) and the fifth line is \(\text{set}<\text{string}> \text{se};\).

 Jun 14, 2020
edited by MaxWong  Jun 14, 2020
edited by MaxWong  Jun 14, 2020
edited by MaxWong  Jun 14, 2020
edited by MaxWong  Jun 14, 2020

3 Online Users

avatar
avatar
avatar