McNuggets problem: Difference between revisions
→{{header|UNIX Shell}}: Add implementation
(→{{header|Clojure}}: Add implementation.) |
(→{{header|UNIX Shell}}: Add implementation) |
||
Line 1,388:
43
</pre>
=={{header|UNIX Shell}}==
{{trans|Clojure}}
{{works with|bash}}
{{works with|ksh}}
{{works with|zsh}}
<lang bash>possible=()
for (( i=0; i<18; ++i )); do
for (( j=0; j<13; ++j )); do
for (( k=0; k<6; ++k )); do
possible+=( $(( i*6 + j*9 + k*20 )) )
done
done
done
for (( n=100; n; n-- )); do
if printf '%s\n' "${possible[@]}" | fgrep -qx $n; then
continue
fi
break
done
printf 'Maximum non-McNuggets number is %d\n' $n</lang>
{{out}}
<pre>Maximum non-McNuggets number is 43</pre>
=={{header|zkl}}==
|