Problem 9. Who Has the Most Change?
Test #5 seems false:
a = [ 0 1 2 1; 0 2 1 1];
b = 1; % (-> should be 2)
No wonder why the solution map is 99% red...
Fixed. The solutions are being rescored now.
Still broken I think. The question emphasises that the order is nickels before dimes.
... and the example also gives the value of [0 1 0 0] as 0.05, so nickels come second, not third. My solution with dimes second is still showing as correct.
Folks this is still broken (perhaps the wording above is wrong?) [0 1 2 1; 0 2 1 1] still not tested correctly.
The columns should be Quarters, Dimes, Nickels, Pennies. That works as of right now.
I've fixed test #5. Sorry about that!
Test #5 still says a = [ 0 1 2 1; 0 2 1 1]; c = 1. (maybe we have to wait until the server cache is flushed)
Test #5 is still broken.
last test is flawed
I have examined the test suite carefully, and it is correct. This problem is about close reading as much as anything. Please read the first sentence of the problem very carefully.
Yup...it's a petty statement. For those of you who skim the first sentence and then LOOK at the order of the coins below, here's the trick. The specified order is not quarters, dimes, nickels, pennies. So this is not a problem about using MATLAB to solve a problem...it's about reading the problem statement closely. I made the same mistake several times, largely because I saw the coin order where the coin values are listed and went with what I would consider the "natural" order were I actually programming such a calculation. Setting up the vector /this/ way would be as confusing in real life as it is here, and is contraindicated for good programming standards.
Next time hopefully I'll have a computer read for me...
I concur with Ninetrees.
I agree with the last three comments, and I think it is especially 'unfair' for non-americans. If you don't automatically know te values, you will (of course) directly look at the nice 'conversion scheme' that is given, think 'thank you for that' and go completely wrong.
Unless this is of course also teaching about 'commenting in an understandable way.
orders of changes are different in question and note!
So everybody should note that the nickel and dime order is flipped..
This switch made this problem too frustrating!
but i liked it!
i have never used '$',so i got a little frustrated first.
it's not so complicated when you multiply a and vertical matrix containing values
dime=$0.05, nickel=$0.10 :)) unbelieveable but I liked it!
tricky, but nice!
The problem description is a bit confusing.
... the columns represent the number of quarters, nickels, dimes, and pennies
but then in the note they are listed in a different order
quarter = $0.25, dime = $0.10, nickel = $0.05, penny = $0.01
Not sure if this was on purpose, but it tricked me.
Really silly that the order is supposed to be quarters(.25), nickels(.05), dimes(.1), pennies(.01) when one would expect it to be in descending order. I'm sure a lot of the incorrect solutions had good code but were tricked up by the question.
Case 5; a = [ 0 1 2 1; 0 2 1 1]; c = 1; a(1, :) = 0*.25+1*.10+ 2*0.05 + 1*0.01 = $ 0.21 a(2, :) = 0*.25+2*.10+ 1*0.05 + 1*0.01 = $ 0.26 so, output should be 2. and, for Case 6 a(1, :) = $ .10; a(2, :) = $ .05; so output should be 1
i like the little trick
Can someone tell me whats wrong with test no. 5 and 6. ?
I think the problem poster messed up, and didn't want to change his solution... lol
Haha this one made me laugh when the assertion test told me to go back and read it again.
The text 5 is wrong!
yup, that's the line you need to read carefully!
"number of quarters, nickels, dimes, and pennies that person has (in that order)"
Solvable if we notice(^^;
Check the order! The question requires 'quarters, NICKELS, DIMES, and pennies' and NOT 'quarters, DIMES, NICKELS and pennies'
This was a really cool problem. After some thinking and trial and error a solution was not too hard to find. Cool problem!
Check the order in the description: 'quarters, NICKELS, DIMES, and pennies' and NOT 'quarters, DIMES, NICKELS and pennies'
one way to do as i figured c=[0.25 0.05 0.1 0.01];
b = find(sum(a.*c,2) == max(sum(a.*c,2)));
It's a trap!
What does the 'c' stand for in the proposed tests 5 to end?
Is it not possible to attach my code in the solution?
could anyone take a look at my solution and hint how i could simplify??
I have provided so much incorrect solutions...
The following test case run by the test suite does not make any sense for my answer:
a = [ 0 1 2 1; 0 2 1 1];
c = 1;
% There is a lot of confusion about this problem. Watch this.
a = [0 1 0 0; 0 0 1 0];
c = 2;
% Now go back and read the problem description carefully.
Read the description of the problem carefully. The author specifically says: quarters, NICKELS, DIMES and pennies.
If you still have problems, that's the part where you should be careful at.
Reading the description again and again gives you a lot of clarity. Tricky one :p
It would be great, if there would be a DOWNvote button. Why should one provide an unordered list?
LOL, this a troll of a problem - as others say, the input array isn't the normal order of the coins - they even add the values of each of these coins in the correct order later in the description just to mess with you XD
I'm also amused by how many people are passionately defending the problem-creator - I can't decide if it's a brilliant troll or just plain old annoying, but being a teacher's pet is the incorrect answer to life (even if it gets you far).
Although the problem is easy enough but the instructions given in the way is ridiculous
BE CAREFUL WITH THE NUMBERS TWIST AT THE START!
The currency is not sorted in descending or ascending order
A play on words.........
Solution CommentsShow comments
Problem Recent Solvers8321
Determine if a Given Number is a Triangle Number
Output any real number that is neither positive nor negative
More from this Author96
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!