整理一元一次方程
[Java] 纯文本查看 复制代码 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);
}
}
|