###################################################################### ##GetMicrosoftJob: Save this file as GetMicrosoftJob. To use it, # #stay in the # ##same directory, get into Maple (by typing: maple ) # ##and then type: read GetMicrosoftJob : # ##Then follow the instructions given there # ## # ##Written by Doron Zeilberger, Temple University , # #zeilberg@math.temple.edu. # ####################################################################### #Created: Sept. 25, 1998 #This version: Sept. 28, 1998 #GetMicrosoftJob: A Maple package to study the Generalized #Microsoft recruiting puzzle #Please report bugs to zeilberg@math.temple.edu print(`GetMicrosoftJob: A Maple package to study the Generalized`): print(`Microsoft recruiting puzzle.`): print(`It is a companion of the paper by S.B. Ekhad and D. Zeilberger`): print(`Entitled:The Generalized U2-Flashlight Microsoft 5-Minute Puzzle`): print(`Please report bugs to zeilberg@math.temple.edu`): print(``): print(`This Maple package was inspired by the following riddle`): print(`allegdly posed to Microsoft job candidates, who are`): print(`required to solve it in less than five minutes`): print(``): print(`The four members of the U2 band have to cross a bridge at night`): print(`equipped with a flashlight. At most two people can cross the`): print(`bridge at one time. The times it takes them are: 1,2,5, and 10.`): print(`When two people walk together, the faster one has to slow down`): print(`and walk at the pace of the slower one`): print(`How to arrange the crossings in such a way`): print(`that the total time to cross all members is 17 minutes?`): print(``): print(`In order to get hired at Microsoft, put the package below on `): print(` a micro-chip (say on your watch), and type`): print(` "Bill(1,2,5,10);", or whatever times they would give you`): print(``): print(`Created: Sept. 25, 1998.`): print(`This version: 9/25/1999`): lprint(``): print(`Written by Doron Zeilberger, zeilberg@math.temple.edu`): lprint(``): print(`Please report bugs to zeilberg@math.temple.edu`): lprint(``): print(`The most current version of this package and paper`): print(` are available from`): print(`http://www.math.temple.edu/~zeilberg`): print(`For a list of the procedures type ezra(), for help with`): print(`a specific procedure, type ezra(procedure_name)`): print(``): ezra:=proc() if args=NULL then print(`Contains the following procedures:Bill, CheapestPaths, BillGates`): print(` Gates, GatesT, Leonardo, Win95, Win98 `): fi: if nops([args])=1 and op(1,[args])=Leonardo then print(`Leonardo(a,n): The set of expressions, in terms`): print(`of the times a[1]<...gu1 do gu:=gu1: gu1:=Nake1(gu1,L,a): od: fi: gu1: end: Pisa:=proc() local a,gu,mu,i: gu:=sort([args]): mu:=Leonardo(a,nops(gu)): for i from 1 to nops(gu) do mu:=subs(a[i]=gu[i],mu): od: min(op(mu)): end: ################## #Leonardo1(a,n): The set of expressions, in terms #of the times a[1]<...Mini do od: r:=r-1: mu:=[]: for i from 0 to r-1 do mu:=[op(mu),{gu[1],gu[2]},{gu[1]},{gu[n-2*i],gu[n-2*i-1]},{gu[2]}]: od: for i from 0 to n-2*r-3 do mu:=[op(mu),{gu[1],gu[n-2*r-i]},{gu[1]}]: od: mu:=[op(mu),{gu[1],gu[2]}]: mu,Mini: end: Gates:=proc() local mu: mu:=GatesT(args): print(`The shortest total time is`, mu[2]): print(`One way of doing it is`): sipur([mu]) end: