Jump to content
BrainDen.com - Brain Teasers

BobbyGo

Members
  • Posts

    142
  • Joined

  • Last visited

  • Days Won

    4

Posts posted by BobbyGo

  1. By not run forever, do you mean that we must be able to fix a time at which the algorithm will certainly have terminated by? If you mean that it just has to end at some point then

    Just generate a random binary number with the same number of digits as n, if the result is higher than n then discard and repeat. It is inevitable that this will end but there is no upper bound on the time taken.

    This seems like it would work. There is only one issue I can see that that might come up. Although it is unlikely, there is a small chance that all of the random binary numbers could be 0. Either there should be a check to discard it or have 1 added before comparing it to n.

  2. 1) Why are "links" golf courses so called

    Is it because they are all owned by the same organization?

    2) If the temperature is described as (eg) 82F in Winston-Salem, NC, or 28C London, how is that figure arrived at?

    Someone beat me to thermometer, so... does it have anything to do with elevation?

    3) Why do gentlemen prefer blondes?

    Subconsciously, yellow is the color of sunshine and happiness so blondes are perceived to be happier or "more fun".

  3. If only the blocks and strings are allowed to be used, 5 blocks could be arranged to allow the string to pass from the top yellow corner of the bottom block to the bottom yellow corner of the top block. One block would be used as a spacer sandwiched between the two blocks just outside the diagonal. The last two blocks would be used as guides to make sure the blocks are aligned on the x and y axes.

  4. Can the students use a marker to mark the string?

    If so, they could start one end of the string on one of the yellow corners and mark the string where it reaches the nearest corner. Once that is done, move the string from the yellow corner to the corner that was used to mark the string. The marked piece of string should be moved in the same direction and should now be located in the air "above" the block. If the remainder of the string is long enough, it can now be directly connected to the opposing yellow corner and measured. If it is not, one of their classmates could use their string to measure the distance.

  5. 1/16 or 6.25%

    The length of the sqrt(3) chord can form a right triangle with the midpoint of the circle as one angle, the end of the chord as another angle, and the midpoint of the chord as the right angle. Since the radius of the circle is one, the length of the distance from the midpoint of the chord to the midpoint of the circle should be equal to the probability that the length of the chord created by the intersection of the circle and a random line is greater than or equal to sqrt(3). This should be true irrespective of orientation.

    Good ole Pythagoras said that a2+b2=c2. Since b equals sqrt(3)/2 and c is 1, a should be equal to 1/16.

  6. 4

    If I'm reading this right, the 3 light-bulbs that are turned on by flicking an individual switch cannot be any of the 3 light-bulbs that are turned on when all 3 switches are flicked. If they were, then at least one bulb would be powered on by two different 2 switch combinations; and since the op stipulated that "if a switch turns on a light-bulb, that switch must be on to turn it on again (even if flicking 2 switches)", two different pairs of switches cannot be used to power any individual bulb.

    Test #1: Flick all 3 switches.

    You now know which 3 light-bulbs are powered when all 3 switches are flicked. Label these bulbs D, E, and F.

    You also know which 3 light-bulbs are powered individually, but don't know which switch corresponds to which bulb. Label these bulbs A, B, and C.

    Test #2: Flick switches 1 and 2.

    If any of the light-bulbs that turn on are bulbs D through F, then you know all of the combinations for turning those bulb(s) on.

    If any of the light-bulbs that turn on are bulbs A through C, then you know those bulb(s) also get powered on individually by either switch 1 or switch 2.

    If both of the light-bulbs that turn on are bulbs A through C, then you also know that the unpowered bulb from the A through C group is powered individually by switch 3.

    Test #3: Flick switches 1 and 3.

    If any of the light-bulbs that turn on are bulbs D through F, then you know all of the combinations for turning those bulb(s) on.

    If any of the light-bulbs that turn on are bulbs A through C, then you know those bulb(s) also get powered on individually by either switch 1 or switch 3.

    If both of the light-bulbs that turn on are bulbs A through C, then you also know that the unpowered bulb from the A through C group is powered individually by switch 2.

    The two light-bulbs that were not powered on during either test 2 or 3 are powered when both switches 2 and 3 are flicked.

    If any of these light-bulbs are bulbs D through F, then you know all of the combinations for turning those bulb(s) on.

    If any of these light-bulbs are bulbs A through C, then you know those bulbs also get powered on individually by either switch 2 or switch 3.

    If both of these light-bulbs are bulbs A through C, then you also know that the remaining bulb from the A through C group is powered individually by switch 1.

    Test #4: Flick switch 1 only. (If you already know which bulb switch 1 powers individually, flick switch 2 instead.)

    If you flicked switch 1, then you know which light-bulb it powers and have enough information to deduce which remaining bulbs from the A through C group are powered by either switch 2 or switch 3.

    If you flicked switch 2, then you know which light-bulb it powers and the only remaining bulb from the A through C group is powered by the only remaining switch (3).

    I had considered testing for heat and testing for light to count as two different tests because you would need to use two different senses to acquire the information. If this is correct, I'll stick with my answer above.

    If this is not the case, I'll change my answer to the one below.

    2

    This uses the same reasoning as my previous answer, but is condensed down to account for both heat and light. Also, because it cannot be known which bulb is powered individually by switch 1 after just the first test, I'm using the knowledge gained about switch 3 during the first test to determine which second test gets executed.

    Test #1: Flick all 3 switches. Wait. Turn off switch 3. Check for heat and light.

    If you know which bulb switch 3 powers individually:

    Test #2: Flick switches 1 and 3. Wait. Turn off switch 3. Check for heat and light.

    If you do not know which bulb switch 3 powers individually:

    Test #2: Flick switches 1 and 3. Wait. Turn off switch 1. Check for heat and light.

  7. 4

    If I'm reading this right, the 3 light-bulbs that are turned on by flicking an individual switch cannot be any of the 3 light-bulbs that are turned on when all 3 switches are flicked. If they were, then at least one bulb would be powered on by two different 2 switch combinations; and since the op stipulated that "if a switch turns on a light-bulb, that switch must be on to turn it on again (even if flicking 2 switches)", two different pairs of switches cannot be used to power any individual bulb.

    Test #1: Flick all 3 switches.

    You now know which 3 light-bulbs are powered when all 3 switches are flicked. Label these bulbs D, E, and F.

    You also know which 3 light-bulbs are powered individually, but don't know which switch corresponds to which bulb. Label these bulbs A, B, and C.

    Test #2: Flick switches 1 and 2.

    If any of the light-bulbs that turn on are bulbs D through F, then you know all of the combinations for turning those bulb(s) on.

    If any of the light-bulbs that turn on are bulbs A through C, then you know those bulb(s) also get powered on individually by either switch 1 or switch 2.

    If both of the light-bulbs that turn on are bulbs A through C, then you also know that the unpowered bulb from the A through C group is powered individually by switch 3.

    Test #3: Flick switches 1 and 3.

    If any of the light-bulbs that turn on are bulbs D through F, then you know all of the combinations for turning those bulb(s) on.

    If any of the light-bulbs that turn on are bulbs A through C, then you know those bulb(s) also get powered on individually by either switch 1 or switch 3.

    If both of the light-bulbs that turn on are bulbs A through C, then you also know that the unpowered bulb from the A through C group is powered individually by switch 2.

    The two light-bulbs that were not powered on during either test 2 or 3 are powered when both switches 2 and 3 are flicked.

    If any of these light-bulbs are bulbs D through F, then you know all of the combinations for turning those bulb(s) on.

    If any of these light-bulbs are bulbs A through C, then you know those bulbs also get powered on individually by either switch 2 or switch 3.

    If both of these light-bulbs are bulbs A through C, then you also know that the remaining bulb from the A through C group is powered individually by switch 1.

    Test #4: Flick switch 1 only. (If you already know which bulb switch 1 powers individually, flick switch 2 instead.)

    If you flicked switch 1, then you know which light-bulb it powers and have enough information to deduce which remaining bulbs from the A through C group are powered by either switch 2 or switch 3.

    If you flicked switch 2, then you know which light-bulb it powers and the only remaining bulb from the A through C group is powered by the only remaining switch (3).

  8. FIRE!



    Correct! You are trekking up the side of Mount Soonexplodey when suddenly you hear a terrible rumbling noise! The volcano is erupting! Luckily, you are clear of hot ash, but a swift-moving flow of lava is coming your way. You have several options of where to escape:

    1. A nearby hot springs

    2. Up a tree

    3. Back into the cave

    4. Into a stream

    5. Toward the volcano

    (also, explain why your place of refuge is the most logical)

    Note: this is obstacle number four. Six more to go!

    Fire can be found in a tree because the lava caused it to start burning.

    Your mother gets FIRED up inside and starts yelling when you don't listen to her.

  9. yeah i find it truly interesting.

    I calculated more ways to make 7 after two rolls meaning that it would have a higher theoretical probability than 6 as opposed to your experimental probability.

    The count definitely gets big as we are dealing with a massive tree diagram of possible outcomes of up to 13 possible rolls.

    While the individual chances of totaling to 7 is greater than totaling to 6 after the first roll, the cumulative totals always favor 6. For example, the chances of landing a 7 or 6 on the second throw is 6/36 and 5/36 respectively, but 6 already had a 1/6 chance added from the first roll. Bonanova's simulations produced results very close to the actual figures. (Although, I'm not sure how well Excel handles rounding, so he very well might be spot on.)

  10. If the die stops being rolled once the cummulative total is larger than twelve, then the highest possible total is 18, and there is only one previous total (12) that could have made that happen. If the previous total had been 11, 18 could not have been reached. If it had been 13, the die would not have rolled again.

    With that in mind, the the second highest total (17) could have two different previous totals (11 and 12), 16 could possibly have any of three previous totals, and on down until we reach 13 which could have been made from any of six previous totals. Given that it has the most previous totals leading up to it, 13 should be the final total most likely obtained.

  11. Your wish is granted...and now wasted. Enjoy!

    I wish that you (the genie) will not corrupt my, or anyone else's wish. (Now at least others can get their wishes)

    Granted. Wishes must now be fulfilled as expected.

    I wish that you (the genie) will corrupt my, or anyone else's wish.

  12. Granted. A platter of cookies appears before you. They are the most delightfully delicious cookies ever created. They also cause instant death upon consumption. The glass containing the milk is shatter-proof and has no lid.

    I wish, with complete control on my behalf, to be perfectly fluent in every dialect of every language, real or made up. This applies to both written and spoken languages and does not cause any diminished performance of my senses, cognitive functions, or other abilities.

  13. Plant 1: 10 to City 2 @ $6 and 25 to City 3 @ $10

    Plant 2: 45 to City 1 @ $9 and 5 to City 3 @ $13

    Plant 3: 10 to City 2 @ $9 and 30 to City 4 @ $5

    Total Cost = $1020

    As par for the course, this could probably have be made a lot more elegantly, but it seems to get the job done.

    Fair warning: this took about 20 seconds to spit out an answer. Feel free to uncomment the cout after the first for loop if you are really into countdowns.

    int a, b, c, d, e, f, g, h, i, j, k, l, a1, b1, c1, d1, e1, f1, g1, h1, i1, j5, k1, l1, money=10000;
    
    int main()
    {
        for(a=35; a>=0; a--)
        {
            //cout<<a<<endl;
            for(b=((35-a)>20 ? 20 : (35-a)); b>=0; b--)
            {
                for(c=((35-(a+>30 ? 30 : (35-(a+); c>=0; c--)
                {
                    d=35-(a+b+c);
    
                    for(e=45-a; e>=0; e--)
                    {
                        for(f=((50-e)>20 ? 20 : (50-e)); f>=0; f--)
                        {
                            for(g=((50-(e+f))>30 ? 30 : (50-(e+f))); g>=0; g--)
                            {
                                h=50-(e+f+g);
    
                                for(i=((a+e)<5 ? 0 : 45-(a+e)); i>=0; i--)
                                {
                                    if(a+e+i==45)
                                    {
                                        for(j=((40-i)>20 ? 20 : (40-i)); j>=0; j--)
                                        {
                                            if(b+f+j==20)
                                            {
                                                for(k=((40-(i+j))>30 ? 30 : (40-(i+j))); k>=0; k--)
                                                {
                                                    if(c+g+k==30)
                                                    {
                                                        l=40-(i+j+k);
    
                                                        if(d+h+l==30 and (8*a+6*b+10*c+9*d+9*e+12*f+13*g+7*h+14*i+9*j+16*k+5*l)<=money)
                                                        {
                                                            money=(8*a+6*b+10*c+9*d+9*e+12*f+13*g+7*h+14*i+9*j+16*k+5*l);
                                                            a1=a;b1=b;c1=c;d1=d;
                                                            e1=e;f1=f;g1=g;h1=h;
                                                            i1=i;j5=j;k1=k;l1=l;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    
        cout<<a1<<"  "<<b1<<"  "<<c1<<"  "<<d1<<endl<<e1<<"  "<<f1<<"  "<<g1<<"  "<<h1<<endl<<i1<<"  "<<j5<<"  "<<k1<<"  "<<l1<<endl<<"= $"<<money<<endl;
    	return 0;
    }
    
    

  14. Since you have an unlimited supply of trays...

    Could you use the extra trays as separators? They could be broken apart and wedged in along the edges just enough so that the trays on top do not dip into the ones underneath. Or possibly even used to prop up the trays "card-house style".

  15. If you're interested, I ran a bit of code to find the answer...

    This is kind of like cheating... you're not a cheater, are you?

    Okay, fine. The maximum revenue is produced by making 2 desks, 0 tables, and 8 chairs for a total of $280.

    double d, t, c, d1, t1, c1, money=0;
    
    int main()
    {
        for(d=0; d<5; d++)
        {
            for(t=0; t<7; t++)
            {
                for(c=0; c<15; c++)
                {
                    if(d*2 + t*1.5 + c*.5 <= 8 and d*4 + t*2 + c*1.5 <= 20 and d*8 + t*6 + c*1 <=48 and d*60 + t*30 + c*20 > money)
                    {
                        money = d*60 + t*30 + c*20;
                        d1 = d;
                        t1 = t;
                        c1 = c;
                    }
                }
            }
        }
    
        cout<<d1<<" desks, "<<t1<<"  tables, and "<<c1<<" chairs makes: $"<<money<<endl;
    	return 0;
    }
    

  16. Looks like dark magician got this one.

    I forgot to exclude the LWT scenario from my LWW calculations. I mistakenly thought the chance of a win after LW was 1/2, but neglected to realize that is only the case 4/5 of the time.

    LWW = 2/5 x 5/12 x (4/5 x 1/2) = 1/15

    TWW = 1/5 x 1/3 x 1/2 = 1/30

    WW? = 2/5 x 5/12 = 1/6

    1/15 + 1/30 + 1/6 = 4/15 chance one specific player getting two wins in a row

    (x2) = 8/15 chance either player gets two wins in a row

×
×
  • Create New...