fn main() {
let mut chicken = 0; // 初始化鸡的数量
let mut rabbit = 0; // 初始化兔子的数量
// 输入头数
let heads = read_line("请输入头数: ");
while chicken + rabbit != heads {
if (chicken * 2 + rabbit * 4 == heads * 4) {
println!("鸡有{}只,兔子有{}只", chicken, rabbit);
break;
}
chicken += 1;
rabbit += 1;
}
}