/*
Monkey: There's a pile of peaches on the beach, five monkeys to score.
The first monkey divided the pile of peaches by an average of five, one more,
The monkey threw one more into the sea and took a copy of it.
The second monkey divided the remaining peaches into five, and one more,
It also threw a lot of one into the sea, took a part, third, four, fifth monkey
It's all done, ask at least a lot on the beach.
One less peach.
*/
public class dividepeach{public
static void Main (string[] args) {
int num = 6; The minimum number of peaches for the last peach is 6
A: for
(; true;num = 5) {//num++ can also, according to the number of monkeys to determine the num mantissa must be 1 or 6, so add 5 to increase the efficiency
int temp = num;
for (int monkey = 1; monkey <= 5; monkey++)
{
if (temp >= 6 && temp% 5 ==1) { //divide, at least 5 peaches, and must be greater than Equal to 6
temp = TEMP/5 * 4;//The number of peaches, divided 4 times, or the total number of peaches that can be divided is now 4/5 for each monkey, and a monkey took a copy of it.
if (monkey = = 5) {//More than the Division method, when the 5th Monkey is satisfied to find this number of break
A;
}
} else{//Note this else and which if is a pair of break
;
}}
System.out.println ("The beach originally has at least" + num + "peach");
}