+ 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...

28th Jun 2017, 7:14 AM
Ledio Deda
Ledio Deda - avatar
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.
28th Jun 2017, 7:38 AM
Hatsy Rei
Hatsy Rei - avatar
+ 20
Die die die you servant.. You don't deserve to live in that filthy world...😞😑
28th Jun 2017, 8:34 AM
Frost
Frost - avatar
+ 13
The servant is safe because The Kueen orders The King not to kill him
28th Jun 2017, 9:45 AM
‎‏‎‏‎Kueen
‎‏‎‏‎Kueen - avatar
+ 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?
28th Jun 2017, 7:46 AM
김정제(Legacy)
김정제(Legacy) - avatar
+ 8
Technically, if we can buy 100 dogs and merge three dogs to form a ceberus, it would be considered two species (?).
28th Jun 2017, 7:53 AM
Hatsy Rei
Hatsy Rei - avatar
+ 7
Is there a discount for bulk purchase?
28th Jun 2017, 7:21 AM
김정제(Legacy)
김정제(Legacy) - avatar
+ 7
If servant is lucky guy. There will be 1dog which is pregnant. Then dog is 101 now.
28th Jun 2017, 7:35 AM
김정제(Legacy)
김정제(Legacy) - avatar
+ 7
@Rei lol. Your answer is very funny. Buy with 20 and sell it 30. hahaha
28th Jun 2017, 7:44 AM
김정제(Legacy)
김정제(Legacy) - avatar
+ 7
Oh no. That too realistic result.(No fun..) I thought you have solution to make him alive.
28th Jun 2017, 7:57 AM
김정제(Legacy)
김정제(Legacy) - avatar
+ 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.
28th Jun 2017, 9:39 AM
seamiki
seamiki - avatar
+ 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
28th Jun 2017, 7:30 AM
김정제(Legacy)
김정제(Legacy) - avatar
+ 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...
28th Jun 2017, 7:33 AM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 6
But didnt you said at least two different type? x = 100 y = 0 z = 0 is just 1
28th Jun 2017, 7:53 AM
김정제(Legacy)
김정제(Legacy) - avatar
+ 6
Maybe servant assassinates King.
28th Jun 2017, 9:58 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 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
28th Jun 2017, 7:26 AM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 5
lul nice thats the plot twist i see
28th Jun 2017, 7:29 AM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 5
Hatsy we don't want Cerberus the hound. It also has a snake for a tail. Where to get the snake? XD
28th Jun 2017, 7:54 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 5
And yes he will die
28th Jun 2017, 7:55 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 5
RIP servant. 2000-2017
28th Jun 2017, 7:55 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 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
28th Jun 2017, 7:59 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar