基叔
基叔回复给帖子:9465581
>>
完整版
[mw_shl_code=ruby,true]print "Heads"
heads=Integer(gets.chomp)
print "Legs"
legs=Integer(gets.chomp)
for c in 0..heads
if (heads - c)*4+c*2 == legs
puts "Chicken =#{c} \nRabbit = #{(heads - c)}"
end
end[/mw_shl_code]