刚学不久献个丑,错了请指正
class Monkey {
public static void main(String[] args) {
System.out.println(min());
}
public static int min() {
int x = 0; //核桃总数
//int x1,x2,x3,x4; //5个猴子分别到手的核桃数
for (int i = 1; i < 10000; i++) {
if ((i - 1) % 5 == 0) {
int x1 = (i - 1) / 5;
if ((x1 - 1) % 5 == 0) {
int x2 = (x1 - 1) / 5;
if ((x2 - 1) % 5 == 0) {
int x3 = (x2 - 1) / 5;
if ((x3 - 1) % 5 == 0) {
int x4 = (x3 - 1) / 5;
if ((x4 - 1) % 5 == 0 & (x4 - 1) / 5 != 0 ) {
x = i;
break;
}
}
}
}
}
}
return x;
}
} |