Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This question is descrete math 6: A very disturbed group of mathematicians will

ID: 3595128 • Letter: T

Question

This question is descrete math 6: A very disturbed group of mathematicians will only allow other mathematicians to join their group if the person's birthdate (month, day, and year) as an 8 digit value contains the exact same 8 digits as the founding member, whose birthdate is 07-09-1963. A new mathematician seeks to join and notes their birthday is 06-30-1979, and because the digits are the same, is permitted membership. Assuming the dash marks play no role in the determination, how many different birthdate combinations permit membership, assuming age plays no role (that is, someone might be inducted posthumously, well after death, or would be permitted even if not born yet.) NOTE: you do have to consider what dates and months are possible in coming up with your response.

Explanation / Answer

#include <iostream>
#include <cstring>
using namespace std;
void swap(char *a,char *b)
{
        char t=*a;
        *a=*b;
        *b=t;
        return;
}
void permute(char *a,int l,int r)
{
        int i;
        if (l==r)
        {
       if(((a[0]<='2')||((a[0]=='3')&&((a[1]=='0')||(a[1]=='1'))))&&(((a[2]=='0')&&(a[3]!='0'))||((a[2]=='1')&&((a[3]=='0')||(a[3]=='1')||(a[3]=='2')))))
       {
                   cout<<a<<endl;
       }
        }
        else
        {
                for(i=l;i<=r;i++)
                {
                       swap(a+l,a+i);
                       permute(a,l+1,r);
                       swap(a+i,a+l);
                }
        }
}
int main()
{
        char a[]="07091963";
        permute(a,0,5);
        return 0;
}

Output:-

07091963
07099163
07019963
07019963
07091963
07099163
07109963
07109963
09071963
09079163
09017963
09019763
09091763
09097163
09107963
09109763
01097963
01099763
01079963
01079963
01097963
01099763
09091763
09097163
09019763
09017963
09071963
09079163
09109763
09107963
07091963
07099163
07019963
07019963
07091963
07099163
07109963
07109963
09071963
09079163
09017963
09019763
09091763
09097163
09107963
09109763
01097963
01099763
01079963
01079963
01097963
01099763
09091763
09097163
09019763
09017963
09071963
09079163
09109763
09107963
17090963
17099063
17090963
17099063
17090963
17099063
17090963
17099063
10097963
10099763
10079963
10079963
10097963
10099763
19070963
19079063
19090763
19097063
19070963
19079063
19090763
19097063
10097963
10099763
10079963
10079963
10097963
10099763
19090763
19097063
19070963
19079063
19090763
19097063
19070963
19079063

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote