4 ms·
I solved it in my head, using a bit of brute force, but mostly some informal reasoning. Basically (and a tad spoilingly): Since we're dealing with whole chicke
by zwegner 12y ago
I solved it in my head, using a bit of brute force, but mostly some informal reasoning. Basically (and a tad spoilingly):
Since we're dealing with whole chickens, there should an integral ratio between the two prices--that is, M expensive chickens should be the same price as N cheap ones. To go from, say, 10 to 16 chickens requires replacing X chickens with X+6 chickens sold later but costing the same in total. Same with 10 to 26 or 16 to 26. The GCD between these differences (6, 10, and 16) is 2, implying N<=M+2. We also know N/M>=2.6, meaning to trade from 10 chickens to 26 you need to get at least 2.6 cheap chickens for every expensive one you replace. So there's only one exchange rate that works: one expensive chicken costs as much as three cheap ones. Using this exchange rate, 8 of the 10 chickens would have to be traded to get 24 out of 26, leaving two chickens for each farmer that were sold for the same total, but at unknown prices. Three possibilities (0, 1, or 2 at the expensive rate) is a pretty easy brute force at that point.
- sopooneo 12y agoHow do you know that "M expensive chickens should be the same price as N cheap ones"? What assures us any two groups of chickens would sell for the same total price?