The above is a natural language. If you use a programming language, obviously, you can't use reasoning. It can only be exhaustive, and recursive functions can be used. The idea is this:
Premise: 1. To others is 1 or 0 yuan (the reason is omitted). 2. There is a function find(a), a), where a stands for remainder. What are the advantages of people who are used to judge the number of surplus people and propose distribution plans? Here is the search code:
Private find(a) is an integer.
Dim b is an integer
K(a)= 1' I will support myself.
B=0' Number of opponents
If a=5, then
find= 100
other
For i= 1 to 4
If a+I <; Then =5
If you find (a+i)> 1 and (I mod 2 = 1) S to oppose you unconditionally, you can get more benefits if I am an odd number.
b=b+ 1
k(a-i)=0
If ... it will be over.
If ... it will be over.
Next, I
find= 100-b
If a= 1
Print "Get it yourself:"
Print 100-b
Print "Other people who get 1 yuan:"
For i=2 to 5
If k(i)= 1
Print I
If ... it will be over.
Next, I
If ... it will be over.
I haven't tried it. There should be a problem. .