It might be possible to do a little better, but I think I can get Explanation:


A complementary result of tehtmi's answer: Using the same strategy, is the maximum number of coins you can get, and +1 is impossible. Proof:


You can solve the problem via integer linear programming as follows. Let $n$ be the number of coins, so we need at most $n$ bags. For $b \in \{1,\dots,n\}$, let nonnegative integer decision variable $x_b$ be the number of coins in bag $b$, with $x_b$ nonincreasing. Let $z$ represent $\max_b \{b\cdot x_b\}$, which is the number of coins the king will take. ...


Can't you just do ?


Their best strategy is Their chances with this strategy are Optimality


The poor robot might get slightly less dizzy with


A slightly different approach as the other answers


Here is my edited improved answer, not sure optimal, there is a methodology but not sure about its optimality anyway: For this, I will put the coins in the bags as below: As a result, There are 4 possibilities for your knight to choose, or or or


I found a solution using This works as follows: The reason why the enemy cannot intercept 10 different messages: Furthermore, this number of days is optimal because of the following argument:


Edit: I'm sure @tehtmi's answer is correct. Kind of irrelevant to my answer, but here is a code for you to experiment with different bag combinations. Simply fill in the bags list and run the program: For bags I used: And @tehtmi used: bags = [] # Put in this list all the numbers you want, with each number representing a bag of that amount of coins keeps =...


Alternative solution:


The following program should work:


I randomly encountered this problem and I think I have a simpler solution (for the special kudos version) than Gareth's:


I now wonder how many solutions there are. Just in case the purpose is to take as long as possible: "the tourist".


It gets a bit messy, but in the end it comes down to algebra.


One sequence is: First, it seems clear that we need at least: This would give something along the lines of: We obviously need something else, though, because: However, we just need a bit of additional logic: Notice, however, there is no one answer:

Only top voted, non community-wiki answers of a minimum length are eligible