<> Monkeys divide bananas
5 A monkey is a good friend , Sleeping on a coconut tree by the sea . in the meantime , A merchant ship left a bunch of bananas on the beach .
The first 1 Monkeys wake up , Divide the bananas equally 5 heap , There are still 1 individual , Just eat and hide one of them and go to sleep .
The first 2 Monkeys wake up , Divide the bananas again 5 heap , There are still 2 individual , Eat and hide one of your own and go to sleep .
The first 3 Monkeys wake up , Divide the bananas again 5 heap , There are still 3 individual , Just eat and hide one of them and go to sleep .
The first 4 Monkeys wake up , Divide the bananas again 5 heap , There are still 4 individual , Just eat and hide one of them and go to sleep . The first 5 Monkeys wake up , Divide the bananas again 5 heap , ha-ha , There's nothing left !
Please count how many bananas there are at least at the beginning . You need to submit an integer , Don't fill in any superfluous information .
thinking : Recursion should be the best way to solve this problem , But most of all, I choose to be direct for nesting , Because I'm too lazy to think . But recursion is recommended , Forced case , Simple code , There's nothing to say , Violence output !
Note that : Each floor for Initial loop variable of
package Lqb; public class Text28 { public static void main(String[] args) {
for(int i=0;i<10000;i++){ int tep=i; if(tep%5==1){ tep=tep-tep/5-1;
if(tep%5==2){ tep=tep-tep/5-2; if(tep%5==3){ tep=tep-tep/5-3; if(tep%5==4){
tep=tep-tep/5-4; if(tep%5==0&&tep>0){ System.out.println(i); } } } } } } } }

Technology
©2019-2020 Toolsou All rights reserved,
QCustomPlot series (5)- Real time dynamic curve python To solve the problem of dictionary writing list in GDOI2019 travels Java Basics ( Bubble sort )Unity Scene loading asynchronously ( Implementation of loading interface )" Cephalosporin wine Say go and go "? DANGER ! Don't drink alcohol when taking these drugs 2021 year 1 Monthly programmer salary statistics , average 14915 element Huawei certification HCIA-AI artificial intelligence java Simple lottery algorithm , luck draw DemoNOI2019 travels