鸡兔同笼共有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
相关文章推荐
- 鸡兔同笼,共有98个头,386只脚,请用穷举法编程计算鸡,兔各有多少只.
- 鸡和兔共15只,共有40只脚,鸡和兔各几只?
- 6.15鸡兔同笼,共有98个头,386只脚,请用穷举法编程计算鸡兔共有多少只。
- 鸡兔同笼,共有98只头,836只脚问鸡兔各有多少只?
- 今天突然想看看自己共有多少个邮箱!
- 请拆招:将两个已排序集合分解成两个独立部分的集合和一个共有部分的集合?
- 面试题1:连续整数之和为1000的共有几组?
- ASP.NET中页面传值共有这么几种方式
- 鸡兔同笼问题
- 鸡兔同笼问题
- 把一张面值为一元的纸币,换成一分,二分,五分的硬币,共有多少种换法?编程输出每一种不同的换法。 如果每种硬币至少有一个,编程求出所需硬币最少的数目及换法。
- CentOS5共有フォルダの設定
- C#判断某年某月共有多少个周末,分别是哪几天
- 1分2分5分的硬币,组成1角,共有多少种组合。
- 3496. 鸡兔同笼
- 第一格一粒米,后一格为前一格的两倍,共有十六格,求总数
- 解密构造精密的手:进化源自共有祖先
- 五子棋(右上)求出给定点的右上方共有多少个连续的相同颜色的子?
- 鸡兔同笼
- 有一篇文章,共有三行文字,每行有80个字符。要求分别统计出其中英文大写字母、小写字母、数字、空格以及其他字符的个数。