If you add 6 to those totals, you get 56,57,58,59,60,61. If you add 6 to those totals, you get 62,63,64,65,66,67.
Problem 2:
So basically, once the condition is true for any run of six, it's true for that run of six + 6, which works out to every number greater than the start of the first run of six. If it were true for a run of nine, it would also be true for that run of nine + 9, etc.
This is my answer to #4, which is a lot like my answer to #3:
# Takes a tuple of three package sizes and a number of nuggets
# Returns True or False depending on whether the exact
# given number of McNuggets can be purchased
def divisible_by_mcnuggets(packages, nuggets):
# We shouldn't bother trying numbers that are greater than the
# total number we're looking for. For example, if the total number
# of nuggets is 50 and one of the packages contains 20 nuggets, we'll
# never want more than 2 of them
maximum_a = nuggets/packages[0] + 1
maximum_b = nuggets/packages[1] + 1
maximum_c = nuggets/packages[2] + 1
# Loop through all possible combinations of the three package sizes
# from 0 to the maximum
for a in range(0, maximum_a):
for b in range(0, maximum_b):
for c in range(0, maximum_c):
if (packages[0]*a) + (packages[1]*b) + (packages[2]*c) == nuggets:
return True
return False
# Prints the largest number of McNuggets that can't be bought up to 150
# for a given set of 3 package sizes
def diophantine_mcnuggets():
bestSoFar = 0 # variable that keeps track of largest number
# of McNuggets that cannot be bought in exact quantity
packages = (6,9,20) # variable that contains package sizes
consecutive_divisibles = []
while len(consecutive_divisibles) < 6:
for n in range(1, 150): # only search for solutions up to size 150
if divisible_by_mcnuggets(packages, n) == True:
consecutive_divisibles.append(n)
else:
consecutive_divisibles = []
bestSoFar = n
print "Given package sizes %i, %i, and %i, the largest number of McNuggets that cannot be bought in exact quantity is: %i" % (packages[0], packages[1], packages[2], bestSoFar)
diophantine_mcnuggets()
#asks for the diffrent package sizes and checks that they are suitable (error handling) while corr_pack==False: print('What are the three packet sizes (in rising order)?') packets=input() if len(packets)!=3: print ('There must be three and only three packet sizes') elif type(packets[0])!=int or type(packets[1])!=int or type(packets[2])!=int: print ('All packet sizes must be given in integrers') elif packets[0]<0 or packets[1]<0 or packets[2]<0: print ('The packet sizes must be positive numbers') elif packets[0]>packets[1] or packets [0]>packets[2] or packets[1]>packets[2]: print ('The packets must be given in a rising order') else: corr_pack=True
while n<200 and no_right< packets[0] : #n loops all possible combinations from 1 and up to a works=False #consecutive number of possibles the same length as the minimum package n+=1 #works turns true as soon as a solution is found, c=0 #a,b,c is how many packages of each size are needed while c*packets[2]<=n and works==False: #each loop goes until the combined number of nuggets is bigger b=0 #than the wanted number. while c*packets[2]+b*packets[1]<=n and works==False: a=0 while c*packets[2]+b*packets[1]+a*packets[0]<=n and works==False:#Goes though all combinations if c*packets[2]+b*packets[1]+a*packets[0]==n: #of a,b&c till a solution is works=True #found or all combinations are tried. else: #starts with a and works it way out. a+=1 #if a correct solution are found works turns True if c*packets[2]+b*packets[1]+a*packets[0]==n: works=True else: b+=1 if c*packets[2]+b*packets[1]+a*packets[0]==n: works=True else: c+=1 if works==True: #if there exists a correct solution the n_right counter incerases no_right+=1 #print n,a,b,c else: #if there isn't, it resets to zero and that number is stored in highest. highest=n no_right=0 #print n,no_right print highest #the highest non-solvable number is printed.
I'm pretty sure this is ugly and I know it's inefficient, but they asked for exhaustive search...
# Solving a Diophantine Equation.
# Helper function
def consecutiveValues(n1, n2, n3, n4, n5, n6):
value = (n1 + 1 == n2) and (n2 + 1 == n3) and (n3 + 1 == n4) and (n4 + 1 == n5) and (n5 + 1 == n6)
return value
# Helper function
def nuggetsTest(n):
answer = False
for a in range(0,11):
for b in range(0,11):
for c in range(0,11):
if (a*6 + b*9 + c*20) == n:
return True
return answer
def mcnuggets():
# Possible instance of number of McNuggets that cannot be purchased
# exactly.
n = 1
# Stores successful values of n.
successful_n = [0,0,0,0,0,0]
# Stores failed values of n.
failed_n = [0]
# We already know from Problem 1 that 50, 51, ..., 55 (and all
# instances thereafter) have exact solutions. So let's set an
# upper bound for a, b, and c as 10, which should catch all
# feasible possibilities for each variable (6*10 = 60).
while consecutiveValues(successful_n[-6], successful_n[-5], successful_n[-4], successful_n[-3], successful_n[-2], successful_n[-1]) == False:
if nuggetsTest(n) == True:
successful_n = successful_n + [n]
print n
else:
failed_n = failed_n + [n]
n = n + 1
print "Largest number of McNuggets that cannot be bought in exact quantity: " + str(failed_n[-1])
Very similar to problem 3. I didn't bother with the other cases they suggested trying, but it would be simple to make the changes.
packages = (6,9,20) # variable that contains package sizes
# helper function #1
def consecutiveValues(n1, n2, n3, n4, n5, n6):
value = (n1 + 1 == n2) and (n2 + 1 == n3) and (n3 + 1 == n4) and (n4 + 1 == n5) and (n5 + 1 == n6)
return value
# helper function #2
def nuggetsTest(n):
answer = False
for a in range(0,34):
for b in range(0,34):
for c in range(0,34):
if (a*packages[0] + b*packages[1] + c*packages[2]) == n:
return True
return answer
def mcnuggets_search():
n = 1
# Stores successful values of n.
successful_n = [0,0,0,0,0,0]
bestSoFar = [0] # variable that keeps track of largest
# number of McNuggets that cannot be
# bought in exact quantity
while consecutiveValues(successful_n[-6], successful_n[-5], successful_n[-4], successful_n[-3], successful_n[-2], successful_n[-1]) == False and n < 200:
if nuggetsTest(n) == True:
successful_n = successful_n + [n]
print n
else:
bestSoFar = bestSoFar + [n]
n = n + 1
print "Given package sizes " + str(packages[0]) + ", " + str(packages[1]) + ", and " + str(packages[2]) + ", the largest number of McNuggets that cannot be bought in exact quantity is: " + str(bestSoFar[-1]) + "."
Does anyone know if there is a limit to how many indentations/levels of nested loops is viable in Python? I'm having an issue with problem 3 in that my nested loops work fine until I add another while loop outside of them, and I can't figure out why.
We used to work together http://gykepugurohy.blog.free.fr/ naked angel bbs I hate the fingernails, but she's a damn pretty natural latin girl, anyway! and she can suck cock and loves it!!! I'd ove to get sucked by her! beautiful lips!!!
How many are there in a book? http://aquytyiqyha.blog.free.fr/ young european models Hate to double post but fuck.. I can't get over how much I love it when women grind like that... No contest if a girl wants to get me off.
The National Gallery http://ofapolyykeg.blog.free.fr/ schoolgirl model samples wtf, why don't asian women stop fuckin crying like dying cats and fuck for once. I only fuck asian americans, women who have seen real fucking, not this bullshit where little dick having guys slowly fuck these hairy pussy squeelers. Go to Cali, not Tokyo.
We went to university together http://opaolate.blog.free.fr/ dee lily model What eyes! Class and style! Fantasic confident woman enjoying her job. Best film I've seen in years, all because of her! (And yes, I am typing with one hand, other is busy) :D
I wanted to live abroad http://anicucegei.blog.free.fr/ pedo modell oh my god he giving it to her right!! shit, i'd take that dick in like a fucking soldier! i was that was my pussy getting fucked like that
How do you know each other? http://anisumoute.blog.free.fr/ voyeur preteen pics hold on im just gonna cum on your face...thats fuckin hilarious if i was a porn cameraman id do that every shoot
I'm doing a phd in chemistry http://ekynecirolasu.blog.free.fr/ nonude child model This girl is fucking sexy. I love her tight pussy. I love her so much. That guy is fucking lucky.
We need someone with qualifications http://enytosyjaqo.blog.free.fr/ only porn bbs Pinky is hella fine... i wanna eat her PUSSY so bad... DAMN SHE THE SHIT... THAT FAT ASS CLAPPIN AND SHIT...
I'm on work experience http://yypidugenur.de.tl photo cp bbs I don't think she's ugly.. She's just an average looking everday chick... And she deffently ain't fat. Ya'll have gotten use to seeing all these supermodel looking chicks doing porn
How do you do? http://ogatenetif.de.tl petite model links She is soooo much better at fucking than he is!!!! He had a nice cock though... The first half was pretty good. Eye contact,kissing,intensity..they seemed to be really enjoying fucking each other..He got lazy in the last half thou.. too much doggy style, boring!! he was sitting on his ass and she was doing most of the work..Cumshot was sooo weak. he shoulda just came on her ass.. An internal shot woulda been really HOTTT!!! Oh well...
How many are there in a book? http://bynupaigera.de.tl pretty hot bbs SMOKIN!! I think i'd have a sex change to be with these three! The dark gal is particularly sweet...would love them to grind on my face n cock while they do each other, ahhh. Whats that that just fell into my hand, oh must be my cock...again :p
I've just graduated http://kiduymidisy.de.tl nymphets angel pussy I think her pussy is cute. I would eat it, but I would love to get fucked by his dick =]. It looks so good ;]. LOL
Directory enquiries http://ausouar.de.tl nymphet brazil he puts my small white dick to shame he is fukin sexc fuckin that white bitch tho she looks like shes lovin it
My battery's about to run out http://oqepuhylinys.de.tl nymphets image yooo..she is fuckin loud as hell! lol she can't be makin all the noise for real.. she gotta be fakin!
I'm doing a masters in law http://sajudyfane.de.tl dark portal nymphets That's definitely a MILF! Nice to see MILF is an international term! I would have banged her a lot better. Also noticed maybe they don't eat pussy...their loss!
I can't stand football http://oqepuhylinys.de.tl all pics nymphets THat girl is a fucking CHAMP!!! Holla! And Erik knew what he was doing, getting the nasty ass frenchman to cumming in her second! LOL! She is such a good girl!
I'd like to speak to someone about a mortgage http://onasurubym.de.tl composites bbs Valentina is such a sexy woman and looks great getting worked over in this vid. She takes a DP well and looks hot doing it. Very good scene!
Have you read any good books lately? http://umaceudyfytu.de.tl girl bbs post the only thing i can think of that is funny to say (( is that yellow thing on the counter top a butt plug))
Where did you go to university? http://ubuekujuqim.de.tl non nude nymphs I would love to be sucked by this girl she is an expert, would like to spurt in her mouth
I wanted to live abroad http://komufypipy.de.tl japan teen models bbs lol. i dont know what u losers are getting upset about. this is the world of porn. money buys it all. u losers are so upset about the fact that hes fucking her and shit... dont forget morons, she agreed to it like a cheap slut she is.. shit.. u guys makin her look all glorious and victimized.. gimme a fuckin break. get a life losers hahaha.
How many more years do you have to go? http://olafuynyjik.de.tl daughter bbs I have always wanted to try my hand, rather mouth, at eating pussy. I am curious to eat a woman out. Feel the pussy squeeze my tongue and such... I have a feeling I would be good at it.
What do you study? http://olafuynyjik.de.tl pr teen bbs mhmm she want that naughty pussy fucked hard...needed another guy just forced fucked her...she would have had that bed soaking wet
Gloomy tales http://necikuekyir.de.tl nymphet lingerie models His dicks average bro...Hes fucking this slut and your not. Your watching him fuck this slut. enough about dick size im sick of hearing about it. huge dick or not if you got fuck game you can make any bitch enjoy it...
real beauty page http://igujyfagehu.de.tl sexy virgins nymphets like her tits but god dam it why do they need two black guys there getting in the way i cant see her ass or pussy or boobs
Do you know the address? http://igujyfagehu.de.tl planet lo nymphet I hate when the music drowns out the story and the moaning. I was getting into it then I can't hear what the two females are saying. Sucks
I've got a very weak signal http://edeboteler.de.tl nymphet boy sex can someone tell me what is the name of that blond and does anyone who the name of the movie she did with Kay Parker as a babysitter?
I love this site http://ynulofoti.de.tl underage filipina nymphet She is fucking HOT!!! and would be great to fuck. The guys are lucky and know what there doing.. love the black guy who is he?
no subject
Problem 1:
6a,9b,20c = n
2,2,1 = 50
1,5,0 = 51
2,0,2 = 52
1,3,1 = 53
0,6,0 = 54
1,1,2 = 55
If you add 6 to those totals, you get 56,57,58,59,60,61.
If you add 6 to those totals, you get 62,63,64,65,66,67.
Problem 2:
So basically, once the condition is true for any run of six, it's true for that run of six + 6, which works out to every number greater than the start of the first run of six. If it were true for a run of nine, it would also be true for that run of nine + 9, etc.
(no subject)
(no subject)
(no subject)
Problem #4
Re: Problem #4
Re: Problem #4
(Anonymous) - 2010-03-03 15:59 (UTC) - Expand#4
If anyone have any questions, just ask!
#packets = (6,9,20)
no_right = 0
n=0
highest=0
corr_pack=False
print'Hi!'
#asks for the diffrent package sizes and checks that they are suitable (error handling)
while corr_pack==False:
print('What are the three packet sizes (in rising order)?')
packets=input()
if len(packets)!=3:
print ('There must be three and only three packet sizes')
elif type(packets[0])!=int or type(packets[1])!=int or type(packets[2])!=int:
print ('All packet sizes must be given in integrers')
elif packets[0]<0 or packets[1]<0 or packets[2]<0:
print ('The packet sizes must be positive numbers')
elif packets[0]>packets[1] or packets [0]>packets[2] or packets[1]>packets[2]:
print ('The packets must be given in a rising order')
else:
corr_pack=True
while n<200 and no_right< packets[0] : #n loops all possible combinations from 1 and up to a
works=False #consecutive number of possibles the same length as the minimum package
n+=1 #works turns true as soon as a solution is found,
c=0 #a,b,c is how many packages of each size are needed
while c*packets[2]<=n and works==False: #each loop goes until the combined number of nuggets is bigger
b=0 #than the wanted number.
while c*packets[2]+b*packets[1]<=n and works==False:
a=0
while c*packets[2]+b*packets[1]+a*packets[0]<=n and works==False:#Goes though all combinations
if c*packets[2]+b*packets[1]+a*packets[0]==n: #of a,b&c till a solution is
works=True #found or all combinations are tried.
else: #starts with a and works it way out.
a+=1 #if a correct solution are found works turns True
if c*packets[2]+b*packets[1]+a*packets[0]==n:
works=True
else:
b+=1
if c*packets[2]+b*packets[1]+a*packets[0]==n:
works=True
else:
c+=1
if works==True: #if there exists a correct solution the n_right counter incerases
no_right+=1
#print n,a,b,c
else: #if there isn't, it resets to zero and that number is stored in highest.
highest=n
no_right=0
#print n,no_right
print highest #the highest non-solvable number is printed.
Problem 3
Problem 4
nPtLQmypptMQSGzKShM
(Anonymous) - 2012-01-09 04:20 (UTC) - Expandno subject
(no subject)
YVvTOOWgrt
(Anonymous) 2011-10-28 04:06 am (UTC)(link)mIRbCqsQuQnOU
(Anonymous) 2012-01-25 08:50 pm (UTC)(link)dPzltTGLFjDkdVBUxLl
(Anonymous) 2012-02-22 08:15 am (UTC)(link)umoQpLTIdMpUCHX
(Anonymous) 2012-05-02 01:37 am (UTC)(link)BdDZTcKQWKMK
(Anonymous) 2012-05-02 01:45 am (UTC)(link)wDBtnTZDJukJCkXlo
(Anonymous) 2012-05-02 01:45 am (UTC)(link)xxpPSSnDaNxbf
(Anonymous) 2012-05-02 01:45 am (UTC)(link)XrHLRyVIqQOTeYRru
(Anonymous) 2012-05-02 01:45 am (UTC)(link)NjkPzLmmQFAxQ
(Anonymous) 2012-05-02 01:46 am (UTC)(link)jTEcmknKyDXPhAdB
(Anonymous) 2012-05-02 07:10 am (UTC)(link)qVqxpTvbvc
(Anonymous) 2012-05-02 07:22 am (UTC)(link)QUhKdWvGWmI
(Anonymous) 2012-05-02 09:30 am (UTC)(link)rxhNCRdmMGvxQDYc
(Anonymous) 2012-05-02 07:35 pm (UTC)(link)PRMuioDhrgiAkOh
(Anonymous) 2012-05-02 07:43 pm (UTC)(link)rNPRfOoZsWEvSz
(Anonymous) 2012-05-03 06:01 am (UTC)(link)lySJoSJheSWeeLkf
(Anonymous) 2012-05-03 09:31 am (UTC)(link)EGeLbbQFhVl
(Anonymous) 2012-05-03 12:15 pm (UTC)(link)OSBFQpQJFFaUQ
(Anonymous) 2012-05-03 12:15 pm (UTC)(link)TtMIeJpyHiwEnVKYbFE
(Anonymous) 2012-05-03 12:16 pm (UTC)(link)HiInWgLOPXRLgmFHpZ
(Anonymous) 2012-05-03 12:16 pm (UTC)(link)YFiuWPjktIY
(Anonymous) 2012-05-03 01:48 pm (UTC)(link)FxBqFlWqyIFSEZIHbZk
(Anonymous) 2012-05-03 04:31 pm (UTC)(link)ytrYTxVXTUqBatpJZJ
(Anonymous) 2012-05-03 11:19 pm (UTC)(link)NolgLHaXCcyWEOAzfdF
(Anonymous) 2012-05-04 05:29 am (UTC)(link)rGBUzvmjXy
(Anonymous) 2012-05-04 08:01 am (UTC)(link)vBeYrBABrmj
(Anonymous) 2012-05-04 08:02 am (UTC)(link)PFxzelbIreSvqTEUqb
(Anonymous) 2012-05-04 01:30 pm (UTC)(link)nRtlHJEJAQP
(Anonymous) 2012-05-04 01:30 pm (UTC)(link)TUEZbmHydKOA
(Anonymous) 2012-05-04 01:31 pm (UTC)(link)IGQVTmkKEJE
(Anonymous) 2012-05-04 01:31 pm (UTC)(link)DidoudVTrfpRW
(Anonymous) 2012-05-04 01:31 pm (UTC)(link)