Cody

Solution 100058

Submitted on 19 Jun 2012 by Aurelien Queffurust
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
%% pmin = 20; pmax = 30; d = [1 2 3 4 5]; n = [10 9 4 7 2]; p = fit_distribution(d,n,pmin,pmax) assert(~any(p<pmin) && ~any(p>pmax)) for i = 1:length(d) assert(isequal(n(i), sum(rem(p,d(i))==0))) end
C = 0 tf = 0 iter = 0 p = 26 20 24 28 28 24 21 26 20 24 tf = 1 p = 26 20 24 28 28 24 21 26 20 24
2   Pass
%% pmin = 1; pmax = 50; d = [1 3 5 7 8 9]; n = [40 14 12 6 4 1]; p = fit_distribution(d,n,pmin,pmax); assert(~any(p<pmin) && ~any(p>pmax)) for i = 1:length(d) assert(isequal(n(i), sum(rem(p,d(i))==0))) end
C = 0 tf = 0 iter = 0 p = Columns 1 through 10 50 38 2 28 15 38 42 15 33 28 Columns 11 through 20 1 5 40 4 48 40 12 23 6 3 Columns 21 through 30 46 35 13 16 45 30 12 47 5 14 Columns 31 through 40 33 11 10 41 22 42 29 6 50 44 tf = 1
3   Pass
%% pmin = 100; pmax = 200; d = [1 8 9 15 22]; n = [20 2 1 0 2]; p = fit_distribution(d,n,pmin,pmax); assert(~any(p<pmin) && ~any(p>pmax)) for i = 1:length(d) assert(isequal(n(i), sum(rem(p,d(i))==0))) end
C = 0 tf = 0 iter = 0 p = Columns 1 through 10 178 145 173 172 189 190 130 168 129 177 Columns 11 through 20 170 127 185 148 176 107 154 193 188 179 tf = 1
4   Pass
%% pmin = 5; pmax = 37; d = [1 10 20 3 11]; n = [60 7 1 19 5]; p = fit_distribution(d,n,pmin,pmax); assert(~any(p<pmin) && ~any(p>pmax)) for i = 1:length(d) assert(isequal(n(i), sum(rem(p,d(i))==0))) end
C = 0 tf = 0 iter = 0 p = Columns 1 through 10 20 8 16 35 29 5 27 6 28 11 Columns 11 through 20 32 14 8 9 12 11 12 8 19 22 Columns 21 through 30 30 37 30 16 33 25 11 9 9 26 Columns 31 through 40 18 34 5 10 10 17 27 8 16 28 Columns 41 through 50 31 37 15 16 6 13 17 9 35 10 Columns 51 through 60 18 31 26 32 15 21 13 13 10 18 tf = 1