Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It goes in two parts:</p> <p><strong>Which discount to pick?</strong> </p> <p>Suppose we choose to take any other discount (2 free for <code>m</code> items) than the smallest one (<code>n</code> items, <code>n&lt;m</code>): Buying articles <code>a(1)</code> to <code>a(m)</code> we get articles <code>b</code> and <code>c</code> for free. We could just take the smallest discount, buying articles <code>a(1)</code> to <code>a(n)</code> to get <code>b</code> and <code>c</code> for free, and the buy the items <code>a(n+1)</code> to <code>a(m)</code> for the full price to end up in the same situation. Therefore picking the smallest discount is at worst on par with other choices.</p> <p><strong>Which free articles to pick?</strong></p> <p>Now suppose we apply the discount to items <code>a1</code> and <code>a2</code> instead of the most expensive ones <code>b1</code> an <code>b2</code> (<code>cost(a1)&lt;cost(b1)</code> or <code>cost(a2)&lt;cost(b2)</code>). Let's assume that <code>cost(a1)&lt;cost(a2)</code> since the cases are symmetrical. Three cases arise:</p> <ol> <li>Somehow we still manage to get <code>a2</code> for free as part of a promotion: then we could also have gotten <code>a1</code> if we hadn't picked it already.</li> <li>We have to pay for it, as part of a discount. The discount allows us to buy items costing up to <code>c</code>. One of the following arises: <ul> <li><code>c&lt;=cost(a1)</code>: we may swap <code>a1</code> and <code>a2</code>, which leads to a lower cost for this basket, without changing anything else.</li> <li><code>cost(a2)&lt;=c&lt;cost(a1)</code>: let's call <code>d</code> and <code>e</code> the items we get out of this second discount, <code>d</code> being the most expensive one. We could have picked <code>a2</code> as a free item in the first discount, replacing it by <code>d</code> in the second and picking <code>a1</code> as a free item in the second discount, resulting in a lower or equal cost.</li> </ul></li> <li>We buy it out of a discount: we could have picked <code>a2</code> and paid <code>a1</code> for a lower cost without changing anything else, hence picking <code>a1</code> was suboptimal.</li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload