Four times the number of pigs plus two times the number of chickens, assuming they're not next to a nuclear reactor, is 56.
其它还有什么呢?,4倍的猪的数量加上两倍的鸡的数量,考虑到它们不是住在核反应堆旁的。
And he walks out into the farmyard and he observes 20 heads and 56 legs.
这个农场主有一群猪--这是漫长的一天,一群猪和一群鸡。
On the back of it, an iron bed and a chair and table were tied, and on top of them a crate of Barred Rock chickens."
车尾绑著一张铁床、椅子和桌子,上面还有一箱芦花鸡,“
It is chickenality and eggness, understand?
而是一群的鸡和一堆的蛋?
The chicken would have died sooner of later."
这只鸡早晚会死的“
Remember what range does, it gives me a set or a collection or a tuple of integers from 0 up to 1 - is the last value, so it's going to give me everything from 0 up to the total number of heads.
我将要在这个循环范围内加上鸡的数量,记住循环范围的目的,它给了我一个从一开始的整数集合,或者数组,这是最后的值。
So, real dreams are you're in a submarine wrestling a chicken while your grandmother looks disapprovingly on.
真正的梦是指那些,梦见自己在潜艇里和鸡摔跤,而你奶奶在一旁看得不以为然。
You could say, I could have zero chickens and 20 pigs, does that work? I've got one chicken and nineteen pigs, does that work?
为什么简单列举出所有可能的情况,再一个来检验?你可能会说,我可以有0只鸡和20只猪,这能行吗?
And the question is, so how many pigs does he have, and how many chickens does he have? Wow. What a deep problem, right? But you're going to see why we're going to use this in a second. So you know how to solve this, this is a fifth-grade problem, right?
为了避免歧义,这些猪和鸡都是健全的,现在问题是它到底有多少只猪和鸡呢?,多深刻的一个问题啊,对吗?,但是你将要看到的是,我们为什么要举这个例子,你知道如何解答这个问题?
System of linear equations. What are the equations here? Well, I could say, you know, the number of pigs plus the number of 20 chickens equals 20, right? Because we've got 20 heads. And then what else do I have?
如何解决这个问题呢?,用线性方程式的办法来解决,等式是什么呢?你应该知道,猪的数量加鸡的数量等于,对吧?因为我们有20个头?
I've got two chickens and eighteen pigs, you get the idea.
我有1只鸡和19只猪,这能行吗?,我有2只鸡和18只猪。
This means there is no more chicken and egg.
这意味着不再有单个的鸡和蛋了。
Knowing that, I'm going to say, OK, how many pigs are there, well that's just how we're, however many I had total, minus that amount, and then I can see, how many legs does that give, and then I can check, that the number of legs that I would get for that solution, is it even equal to the number of legs I started with, ah! Interesting. A return.
它将给我返回头的总数,知道了这些之后我可以说好了,有多少猪呢,无论有多少组鸡的数目,我只要用总数减去那个值,之后我就可以知道一共有多少条腿,然后再把这个值和题目中的腿数相比较,看它是否等于一开始的腿数,啊!真有趣,有一个返回值。
应用推荐