import java.util.Scanner;
public class Count {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("请输入腿总数(偶数)");
int numLegs = sc.nextInt();
System.out.println("请输入鸡兔总数(整数)");
int all = sc.nextInt();
//整理一元一次方程
int rabbits=numLegs/2-all;
int chickens =all-rabbits;
System.out.println("鸡:"+chickens+",兔:"+rabbits);
}
}
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |