Comrade Vladimir is getting some flowers for Nadezhda, his Valentine. Being of a precise analytical mind, he plans to spend exactly 2016 rubles on exactly 2016 flowers. At the flower market they sell lilies (3 rubles each), roses (2 rubles each) and daisies (50 kopeks each). Vladimir knows that Nadezhda loves lilies. How many daisies will he get to maximize the number of lilies in the bunch?
Note : Ruble and kopeks are basic monetary units in Russia. And one ruble is equivalent to 100 kopeks.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Yes, this is equivalent to Comrade @Pi Han Goh 's solution... you are both solving 5 L + 3 R = 2 0 1 6
This question is similar to this question , but the numbers becames ridiculously larger. (mutatis mutandis)
For consistency, we convert all the measurement to units of kopeks. So we have the following two points
1) Vladimir wants to spend a total of 201600 kopeks on exactly 2016 flowers.
2) 1 lily costs 300 kopeks, 1 rose costs 200 kopeks, and 1 daisy costs 50 kopeks.
Let L , R and D denote the number of lillies, roses and daisies Vladimir bought respectively. Then from the first point, we have
L + D + R = 2 0 1 6 ( 1 )
And from the second point, knowing that Vladimir spent a total of 2016 kopeks, we have 3 0 0 L + 2 0 0 R + 5 0 D = 2 0 1 6 0 0 , or equivalently (divide both sides by 50):
6 L + D + 4 R = 4 0 3 2 ( 2 )
So we have two diophantine equations. And because we know that Nadezhda loves lilies, that implies that Vladimir bought a non-zero amount of Lilies. In other words, L > 0 . And of course, D , R ≥ 0 .
Taking the difference of the second equation and the first equation, we have
5 L + 3 R = 2 0 1 6 ( 3 )
What's left to check is to find the maximum possible value of L . We could just partition the number into the sum of two numbers: one is a multiple of 5 and the other is a multiple of 3, with the numerical value of the latter number minimized. A quick check shows that it's just 2 0 1 6 = 2 0 1 0 + 6 . Thus L = 2 0 1 0 / 5 = 4 0 2 , R = 6 / 3 = 2 . Thus from ( 1 ) , we have D = 2 0 1 6 − 4 0 2 − 2 = 1 6 1 2 .
Yes, another great short-cut! (+1)
I could just cut and paste my "systematic" solution from the other problem, changing a few numbers...shall I?
Log in to reply
Try posting another solution then? haha! As you can see, I've modified my solution so that there's no "trial and error" which you apparently prefer to avoid.
Footnote : If the reader wants to find all the solutions for ( L , D , R ) when the constraint of maximizing L is dropped, read here .
Log in to reply
Footnote to the Footnote: The reader who wants to find all solutions can also look at my solution: D can be any even number between 1344 and 1612, inclusive, so , there are 135 solutions.
Here is a systematic solution, copied over from here
We are given the equations
L + R + D = 2 0 1 6
3 L + 2 R + D / 2 = 2 0 1 6
The reduced row-echelon form (rref) of this system is
L − 1 . 5 D = − 2 0 1 6
R + 2 . 5 D = 4 0 3 2
meaning that L = − 2 0 1 6 + 1 . 5 D and R = 4 0 3 2 − 2 . 5 D
Now we want L , R , D to be integers, which means that D is an even integer.
Also, L and R must be non-negative, which means that − 2 0 1 6 + 1 . 5 D ≥ 0 and 4 0 3 2 − 2 . 5 D ≥ 0 , or, 1 6 1 2 . 8 ≥ D ≥ 1 3 4 4
Since L is an increasing function of D , we want to maximize D . Comrade Vladimir will buy 1 6 1 2 daisies, the largest even number ≤ 1 6 1 2 . 8 .
And here is a solution, which even a better skilled 5th grader would be able to understand:
If we would only buy daisies, it would cost us 2016 × 0.50 = 1008 rubles and we would have left with 2016 - 1008 = 1008 rubles (which we could use to exchange some of the daisies for more expensive flowers (lillies and/or roses)).
It would cost us to exchange one daisy for one lily 3.00 - 0.50 = 2.50 rubles and 1.50 rubles (= 2.00 - 0.50) to exchange one daisy for one rose.
If we want to have the greatest number of lillies, we have to find out how many times the cost of exchange (2.50) goes into the extra money we have (1008):
1008 ÷ 2.50 = 403.2
This means, that if we would exchange 403 daisies for 403 lillies then we would have left with 0.2 × 2.50 = 0.50 rubles. But we have to spend the exact amount, so it is not a good solution.
However, if we would have a lily less (so we would have 402 lillies), we would have 0.50 + 2.50 = 3.00 rubles left, which we could use to exchange 2 daisies for 2 roses and then we wouldn't have any money left.
Therefore, Vladimir can buy 402 lillies, 2 roses and (2016 - 402 - 2 =) 1 6 1 2 daisies for exactly 2016 rubles.
( Check: 1612 × 0.50 + 402 × 3.00 + 2 × 2.00 = 2016 rubles.)
Good solution I mean!
One could also consider the problem as a kind of linear optimization. After eliminating R we obtain two restrictions:
L = 1.5D - 2016
L <= 2016 - D
The maximum will be reached at a corner of the permitted area given by the intersection of the lines above delivering D = 1612.8. Finally one must only pay attention that there are not partial flowers following:
D = 1612, L = 402, R = 2
Problem Loading...
Note Loading...
Set Loading...
Let the number of lilies, roses and daisies be x , y , z . According to the given information we get 2 equations: x + y + z = 2 0 1 6 . . . . . . ( 1 ) 3 x + 2 y + 2 z = 2 0 1 6 . . . . . ( 2 ) Substituting value of z from ( 1 ) in ( 2 ) and rearranging for x , we get: x = 5 2 0 1 6 − 3 y And since x,y,z are positive integers( Obviously!!) and we have to maximize x we can think of making the numerator a multiple of 5 as large as possible for us.. That occurs for y = 2 and its value is 4 0 2 . Substituting x = 4 0 2 and y = 2 in ( 1 ) we get z = 1 6 1 2 .... which are required no. of Daisies....
Ya... I know it's kinda Trial and Error... But it's not that too bad... :)