chickenquestion.java

来自「《算法设计与分析》王晓东编著」· Java 代码 · 共 26 行

JAVA
26
字号

public class ChickenQuestion {

	/**
	 * @param args
	 */
	public static void chickenQuestion(){
		/**/
		for(int hens=0;hens<=100;hens++){
			int m_left = 100-hens;
			for(int cocks=0;cocks<=m_left/5;cocks++){
				int chicks = (m_left-cocks)*3;
				System.out.println(cocks+"\t"+hens+"\t"+chicks);
			}
		}
		
		
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
			System.out.println("cocks\thens\tchicks\t");
			chickenQuestion();
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?