Countdown: Difference between revisions

Content added Content deleted
(J draft)
m (→‎{{header|J}}: discard duplicate solutions)
Line 44: Line 44:
expr=: {{ (Pa A),(;u`''),Pa B['A B'=.y }}
expr=: {{ (Pa A),(;u`''),Pa B['A B'=.y }}
arith=: [:; <@(+Va, -Va, *Va, %Va,(-Va, %Va)@|.)"1
arith=: [:; <@(+Va, -Va, *Va, %Va,(-Va, %Va)@|.)"1
all=: {{ A#~x=".@>A=.,arith^:5 ":each y}}
all=: {{ A#~x=".@>A=.~.,arith^:5 ":each y}}


task=: {{
task=: {{
Line 55: Line 55:
Examples:
Examples:
<syntaxhighlight lang=J> task''
<syntaxhighlight lang=J> task''
terms: 1 1 5 10 10 75
terms: 2 3 3 6 9 50
target: 736
target: 476
#solutions: 3644
#solutions: 77
for example: (10*(75-1))-(10-(1+5))
for example: (9*(3+50))-(6-(2+3))
task''
task''
terms: 1 2 4 4 7 10
terms: 1 4 6 7 8 9
target: 567
target: 657
#solutions: 37
#solutions: 75
for example: 7*((2+(10*(4+4)))-1)</syntaxhighlight>
for example: 9*(8+((1+4)*(6+7)))
task''
terms: 4 7 8 9 10 10
target: 300
#solutions: 495
for example: (10+(9*10))*((4+7)-8)</syntaxhighlight>


=={{header|Phix}}==
=={{header|Phix}}==