summaryrefslogtreecommitdiff
path: root/prolog/problems/license_plates/checklicenseplate_3/en.py
blob: 4e3e726115c5e6485bad3ba7b75e03fbb9bb9bcb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# coding=utf-8

id = 148
name = 'checkLicensePlate/3'
slug = 'check if the numbers in a license plate form an equation'

description = '''\
<p><code>checkLicensePlate(LP, E1, E2)</code>: the digits in the list <code>LP</code> can be combined into a valid equation <code>E1</code> = <code>E2</code>. <code>E1</code> and <code>E2</code> are arithmetic expressions, obtained from sublists of <code>Plate</code> by inserting arithmetic operators (<code>+</code>, <code>-</code>, <code>*</code> and <code>/</code>) between elements. An additional unary minus can be inserted before the leftmost number of <code>E1</code> and <code>E2</code>.</p>
<pre>
  ?- checkLicensePlate([l,j,l,3,-,2,1,7], E1, E2).
    E1 = 3,       E2 = 21/7 ;
    E1 = -3,      E2 = -21/7 ;
    E1 = 3*2,     E2 = -1+7 ;
    E1 = -3*2,    E2 = 1-7 ;
    E1 = 3*2+1,   E2 = 7 ;
    E1 = -3*2-1,  E2 = -7.
</pre>'''

hint = {}