五家共井问题
public class WJGJ {
static void WJGJ(){
int len1 = 0;
int len2 = 0;
int len3 = 0;
int len4 = 0;
int len5 = 0;
int len = 0;
for(len5 = 4; ;len5 += 4){
for(len1 = 5; ; len1 += 5){
len4 = len5 + len1/5;
len3 = len4 + len5/4;
if(len3 % 2 != 0|| len4 % 3 != 0)
continue;
len2 = len3 + len4 /3;
if(len2 + len3 / 2 < len1)
break;
if(len2 + len3 / 2 == len1)
{
len = 2*len1+len2 ;
System.out.println("甲家井绳长度为:"+len1);
System.out.println("乙家井绳长度为:"+len2);
System.out.println("丙家井绳长度为:"+len3);
System.out.println("丁家井绳长度为:"+len4);
System.out.println("戊家井绳长度为:"+len5);
System.out.println("井深为:"+len);
return;
}
}
}
}
public static void main(String[] args) {
// TODO 自动生成的方法存根
WJGJ();
}
}