Cody

# Problem 42698. Why the heck are they blinking!?!?

Solution 799462

Submitted on 30 Dec 2015 by LY Cao
• Size: 25
• This is the leading solution.
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
%% w=1;n=1; LOL=Length_of_Lights(w,n) test=abs(LOL-3.3830) assert(test<=0.001)

LOL = 3.3830 test = 4.4286e-05

2   Pass
%% w=4;n=5; LOL=Length_of_Lights(w,n) test=abs(LOL-63.1273) assert(test<=0.001)

LOL = 63.1273 test = 1.7843e-05

3   Pass
%% w=20;n=15; LOL=Length_of_Lights(w,n) test=abs(LOL-943.086) assert(test<=0.01)

LOL = 943.0867 test = 7.3228e-04

4   Pass
%% r=[31.4584 62.9167 94.3751 125.8335 157.2919 188.7502 220.2086 251.6670 283.1253 314.5837]; k=ceil(10*rand) LOL=Length_of_Lights(k,10) test=abs(LOL-r(k)) assert(test<=0.001)

k = 8 LOL = 251.6670 test = 3.7581e-05

5   Pass
%% r=[23.6813 45.0198 66.7403 88.5798 110.4727 132.3946 154.3341 176.2850 198.2439 220.2086]; k=ceil(10*rand) LOL=Length_of_Lights(7,k) test=abs(LOL-r(k)) assert(test<=0.001)

k = 6 LOL = 132.3946 test = 4.9617e-05

6   Pass
%% w = floor(sqrt(Length_of_Lights(9,4))) n=floor(sqrt(Length_of_Lights(5,8))) LOL=Length_of_Lights(w,n) test=abs(LOL-345.9679) assert(test<=0.01)

w = 10 n = 11 LOL = 345.9679 test = 3.8959e-05

### Community Treasure Hunt

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

Start Hunting!