Cody

Solution 1319168

Submitted on 29 Oct 2017 by Daniel Meier
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
len = 1; wid = 1; d_correct = 0.7071; assert(abs(birthdaycandles(len,wid)-d_correct)<1e-2)

2   Pass
len = 2; wid = 3; d_correct = 1.8028; assert(abs(birthdaycandles(len,wid)-d_correct)<1e-2)

3   Pass
len = 3; wid = 8; d_correct = 3.6056; assert(abs(birthdaycandles(len,wid)-d_correct)<1e-2)

4   Pass
len = 4; wid = 3; d_correct = 2.5000; assert(abs(birthdaycandles(len,wid)-d_correct)<1e-2)

5   Pass
len = 5; wid = 4; d_correct = 3.2016; assert(abs(birthdaycandles(len,wid)-d_correct)<1e-2)

6   Pass
len = 5; wid = 6; d_correct = 3.9051; assert(abs(birthdaycandles(len,wid)-d_correct)<1e-2)

7   Pass
len = 5; wid = 11; d_correct = 5.5200; assert(abs(birthdaycandles(len,wid)-d_correct)<1e-2)

a = 19.6603 + 0.0000i 0.0000 + 5.0000i 0.0000 - 5.0000i 2.3397 + 0.0000i d = 5.5204

8   Pass
len = 7; wid = 6; d_correct = 4.6098; assert(abs(birthdaycandles(len,wid)-d_correct)<1e-2)

9   Pass
len = 8; wid = 7; d_correct = 5.3151; assert(abs(birthdaycandles(len,wid)-d_correct)<1e-2)

10   Pass
len = 8; wid = 9; d_correct = 6.0208; assert(abs(birthdaycandles(len,wid)-d_correct)<1e-2)

11   Pass
len = 10; wid = 9; d_correct = 6.7268; assert(abs(birthdaycandles(len,wid)-d_correct)<1e-2)

12   Pass
len = 11; wid = 10; d_correct = 7.4330; assert(abs(birthdaycandles(len,wid)-d_correct)<1e-2)

13   Pass
len = 12; wid = 23; d_correct = 12.2018; assert(abs(birthdaycandles(len,wid)-d_correct)<1e-2)

a = 43.7846 + 0.0000i -0.0000 +12.0000i -0.0000 -12.0000i 2.2154 + 0.0000i d = 12.2028

14   Pass
len = 15; wid = 32; d_correct = 16.1616; assert(abs(birthdaycandles(len,wid)-d_correct)<1e-2)

a = 57.9808 + 0.0000i -0.0000 +15.0000i -0.0000 -15.0000i 6.0192 + 0.0000i d = 16.1626

15   Pass
len = 16; wid = 32; d_correct = 16.5644; assert(abs(birthdaycandles(len,wid)-d_correct)<1e-2)

a = 59.7128 + 0.0000i -0.0000 +16.0000i -0.0000 -16.0000i 4.2872 + 0.0000i d = 16.5644

16   Pass
len = 17; wid = 32; d_correct = 17.1902; assert(abs(birthdaycandles(len,wid)-d_correct)<1e-2)

a = 61.4449 + 0.0000i -0.0000 +17.0000i -0.0000 -17.0000i 2.5551 + 0.0000i d = 17.1909

17   Pass
len = 64; wid = 1; d_correct = 16.0312; assert(abs(birthdaycandles(len,wid)-d_correct)<1e-2)

18   Pass
len = 36; wid = 36; d_correct = 25.4558; assert(abs(birthdaycandles(len,wid)-d_correct)<1e-2)

19   Pass
len = 48; wid = 24; d_correct = 24.8466; assert(abs(birthdaycandles(len,wid)-d_correct)<1e-2)

a = 89.5692 + 0.0000i -0.0000 +24.0000i -0.0000 -24.0000i 6.4308 + 0.0000i d = 24.8466

20   Pass
len = 26; wid = 48; d_correct = 26.1679; assert(abs(birthdaycandles(len,wid)-d_correct)<1e-2)

a = 93.0333 + 0.0000i 0.0000 +26.0000i 0.0000 -26.0000i 2.9667 + 0.0000i d = 26.1687

21   Pass
len = 100.25; wid = 100.25; d_correct = 70.8875; assert(abs(birthdaycandles(len,wid)-d_correct)<1e-2)

22   Pass
len = 500; wid = 250; d_correct = 258.8190; assert(abs(birthdaycandles(len,wid)-d_correct)<1e-2)

a = 1.0e+02 * 9.3301 + 0.0000i -0.0000 + 2.5000i -0.0000 - 2.5000i 0.6699 + 0.0000i d = 258.8190

23   Pass
len = 500; wid = 1000; d_correct = 517.6381; assert(abs(birthdaycandles(len,wid)-d_correct)<1e-2)

a = 1.0e+03 * 1.8660 + 0.0000i -0.0000 + 0.5000i -0.0000 - 0.5000i 0.1340 + 0.0000i d = 517.6381

24   Pass
len = randi([1,1e4]); wid = len; d_correct = sqrt((len/2)^2+(wid/2)^2); assert(abs(birthdaycandles(len,wid)-d_correct)<1e-2)