[Math] Solving Integer Linear Problem during hangover

I bought 6 cans of beer.
5 -- somewhat more expensive.
One can -- somewhat cheaper.
Store clerk asked 244 UAH.
What price of each can?

Such problem can be solver easily using SMT solver (including Z3), but many other tools exists.
Let's try Wolfram Mathematica.

We've got a system of equation:

5*x + y == 244 # total sum

x > 0 # non-zero price

y > 0 # ditto

Abs[x - y] < 20 # the difference is not that big

x > y # x is more expensive than y, but not equal

3 possible solutions:

In[]:= Solve[5*x + y == 244 && x > 0 && y > 0 && Abs[x - y] < 20 && x > y, {x, y}, Integers]
Out[]= {{x -> 41, y -> 39}, {x -> 42, y -> 34}, {x -> 43, y -> 29}}

ILP because we work with integer prices.
Kopecks are not used in Ukraine anymore.
Even if used, both variables can reflect price in kopecks, and constants as well.

Yes, I know about these lousy Disqus ads.
Please use adblocker.
I would consider to subscribe to 'pro' version of Disqus if the signal/noise ratio in comments would be good enough.