关闭游戏再进,就会有999个相应的d头
494435737是捕鱼达人3D源代码
赶快送,修复了就没了!
最少合伙捕到3906条鱼
A醒来发现鱼数是3906
B醒来发现鱼数是781
C醒来发现鱼数是156
D醒来发现鱼数是31
E醒来发现鱼数是6
/*** 计算捕鱼
*/
public class Fish {
public String[] piscators = { "A", "B", "C", "D", "E"}
public static void main(String[] args) {
Fish fish = new Fish()
for (int i = 0 i < 10000 i++) {
if (fish.averageFish(fish.piscators.length, i)) {
fish.averageFish(i)
break
}
}
}
/**
* 判断平均分鱼
* @param piscatorSize
* @param fishNum
* @return
*/
public boolean averageFish(int piscatorSize, int fishNum) {
boolean isAaverage = (fishNum - 1) % piscators.length == 0
//最后一个人也分成五分 所以piscatorSize > 0 多分一次。
if (isAaverage && piscatorSize > 0) {
return averageFish(piscatorSize - 1, (fishNum - 1) / piscators.length)
}
return isAaverage
}
/**
* 输出分鱼过程
* @param fishNum
*/
public void averageFish(int fishNum) {
System.out.println("最少合伙捕到"+ fishNum + "条鱼")
for (int i = 0 i < piscators.length i++) {
System.out.println(piscators[i] + "醒来发现鱼数是" + fishNum)
fishNum = (fishNum - 1) / piscators.length
}
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)