您的位置:首页 > 其它

鸡兔同笼共有15只 脚有四十只

2016-05-22 14:21 134 查看

package ForType;

public class JiTu {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int x = 0; //兔
int y = 0; //鸡

for(x = 3;x<15;x++){ //x=3表示兔最少3只起
y = 15-x;
if(x*4+y*2 ==40){
System.out.print(x+" "+y);
}
}

}

}

转载于:https://www.cnblogs.com/RunawayMama/p/5516703.html

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: