Sailors, coconuts and a monkey problem: Difference between revisions
Sailors, coconuts and a monkey problem (view source)
Revision as of 23:31, 8 January 2022
, 2 years ago→{{header|R}}: Syntax highlighting.
ReeceGoding (talk | contribs) (Added R.) |
ReeceGoding (talk | contribs) m (→{{header|R}}: Syntax highlighting.) |
||
Line 1,855:
=={{header|R}}==
The only tricky bit is reading comprehension. For example, it's easy to miss that the coconut count after the final nighttime visit must be strictly positive and divisible by the number of sailors.
<lang
{
stopifnot(sailorCount > 1) #Problem makes no sense otherwise
Line 1,881:
6 7 823537
7 8 117440505</pre>
=={{header|Racket}}==
{{trans|Python}}
|