+ 8
Challenge - Diophantus equation
The king asks to his servant to buy with 1000 gold coins 100 animals: horses, dogs and cows, in order to spend all the coins. One horse costs 20 coins, one dog is 10 coin and one cow costs 40 coins. If the servant doesn't send to the king at least two different kinds of animals, he will be killed. FIND IF THE SERVANT WILL LIVE AFTER HE BRINGS THE ANIMALS TO THE KING...
51 Antworten
+ 12
My C++ program says he's going to die, but a little bug I commited (animal count was negative!) reminded me of something.
If the servant bought all horses for 20 and sold all for 30, he would eventually have enough to fulfill the request.
1000 gold = 50 horses
// sell for 30 per horse, income 10 per horse
// total income 1500 gold
Now, 1500 gold can buy 50 horses and 50 dogs.
+ 20
Die die die you servant.. You don't deserve to live in that filthy world...😞😑
+ 13
The servant is safe because The Kueen orders The King not to kill him
+ 8
(x - dog, y - horse, z - cow)
10x + 20y + 40z <= 1000
x + y + z = 100
(At least 2 of x, y, z is over 0)
is it possible?
+ 8
Technically, if we can buy 100 dogs and merge three dogs to form a ceberus, it would be considered two species (?).
+ 7
Is there a discount for bulk purchase?
+ 7
If servant is lucky guy.
There will be 1dog which is pregnant.
Then dog is 101 now.
+ 7
@Rei
lol. Your answer is very funny.
Buy with 20 and sell it 30. hahaha
+ 7
Oh no. That too realistic result.(No fun..)
I thought you have solution to make him alive.
+ 7
the question is: was programming really necessary?
No solution from the start lead to our pindaric flights in different directions.
Probably a more programming related question would have generated more programming answers...
I had a good time with this thread anyway.
+ 6
No discount?!
Then I cant solve this problem.
What I just thought was following.
1. Get discount for bulk purchase
2. Send king to 100dogs and himself(he is animal too)
3. Buy 100dogs and Spend his 20coin for horse
+ 6
no buy one horse, one dog, two cows.
dog is for companion, two cows for breeding so u will have an ample food supply, the horse is to run away...
+ 6
But didnt you said at least two different type?
x = 100 y = 0 z = 0 is just 1
+ 6
Maybe servant assassinates King.
+ 5
that cannot even be solved like the cheapest animal is a dog and u spend 10 coins on one if u want 100 animals and lets say u buy 100 dogs u gon spend 1000 coins which is how much u have
+ 5
lul nice thats the plot twist i see
+ 5
Hatsy we don't want Cerberus the hound.
It also has a snake for a tail. Where to get the snake? XD
+ 5
And yes he will die
+ 5
RIP servant.
2000-2017
+ 5
Solution: Hypnotism
Make it okay for master to spare him at alk costs then don't buy a single animal and keep money as salary. XD