Cody

Problem 46576. Award medals to winners

Solution 3018085

Submitted on 1 Oct 2020 at 14:57 by James
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

Test Suite

Test Status Code Input and Output
1   Pass
x = [1 5 2 6 3 7]; [w1_correct,w2_correct,w3_correct] = deal(6,4,2); [w1,w2,w3] = medalists(x); assert(isequal(w1,w1_correct) && isequal(w2,w2_correct) && isequal(w3,w3_correct))

x = 1.0e+308 * 0.0000 0.0000 0.0000 0.0000 0.0000 -1.7977

2   Pass
x = [12 20 14 50 33 50 8 1]; [w1_correct,w2_correct,w3_correct] = deal([4 6],[],[5]); [w1,w2,w3] = medalists(x); assert(isequal(w1,w1_correct) && isequal(w2,w2_correct) && isequal(w3,w3_correct))

x = 1.0e+308 * 0.0000 0.0000 0.0000 -1.7977 0.0000 -1.7977 0.0000 0.0000

3   Pass
x = [33 33 33 12 20 14 50 33 50 8 1]; [w1_correct,w2_correct,w3_correct] = deal([7 9],[],[1 2 3 8]); [w1,w2,w3] = medalists(x); assert(isequal(w1,w1_correct) && isequal(w2,w2_correct) && isequal(w3,w3_correct))

x = 1.0e+308 * 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -1.7977 0.0000 -1.7977 0.0000 0.0000

4   Pass
x = [9 8 8 9 1 3 4 2 3 9]; [w1_correct,w2_correct,w3_correct] = deal([1 4 10],[],[]); [w1,w2,w3] = medalists(x); assert(isequal(w1,w1_correct) && isequal(w2,w2_correct) && isequal(w3,w3_correct))

5   Pass
x = [9 8 8 9 1 10 3 4 2 3 9]; [w1_correct,w2_correct,w3_correct] = deal(6,[1 4 11],[]); [w1,w2,w3] = medalists(x); assert(isequal(w1,w1_correct) && isequal(w2,w2_correct) && isequal(w3,w3_correct))

x = 1.0e+308 * 0.0000 0.0000 0.0000 0.0000 0.0000 -1.7977 0.0000 0.0000 0.0000 0.0000 0.0000

6   Pass
x = [9 8 8 9 1 3 4 2 3 9 0 -1 15 pi 12]; [w1_correct,w2_correct,w3_correct] = deal(13,15,[1 4 10]); [w1,w2,w3] = medalists(x); assert(isequal(w1,w1_correct) && isequal(w2,w2_correct) && isequal(w3,w3_correct))

x = 1.0e+308 * 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0 -0.0000 -1.7977 0.0000 0.0000

Suggested Problems

More from this Author48

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!