#110.—THE ABBOT'S PUZZLE. # #The first English puzzlist whose name has come down to us #was a Yorkshireman no other than Alcuin, Abbot of Canterbury #(A.D. 735-804). Here is a little puzzle from his works, #which is at least interesting on account of its antiquity. #"If 100 bushels of corn were distributed among 100 people in #such a manner that each man received three bushels, each woman #two, and each child half a bushel, how many men, women, and #children were there?" Now, there are six different correct #answers, if we exclude a case where there would be no women. #But let us say that there were just five times as many women #as men, then what is the correct solution? #set maximum number for man woman and child m=range(1,34) w=range(1,50) c=range(1,200) answer=[] for m1 in m: for w1 in w: for c1 in c: if 3*m1 + 2*w1 + 0.5*c1==100 and 5*m1==w1 and m1+w1+c1==100: answer.append(m1) answer.append(w1) print "the number of men were %d" % (m1) print "the number of women were %d" %(w1) print "the number of children were %d" %(c1) answer.append(c1)
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question