Cody

# Problem 44387. Birthday cake

Solution 1648713

Submitted on 15 Oct 2018 by Yu Han
• Size: 8
• 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
len = 1; wid = 1; d_correct = 0.7071; assert(abs(birthdaycandles(len,wid)-d_correct)<1e-2)

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In birthdaycandles (line 2) In ScoringEngineTestPoint1 (line 3) In solutionTest (line 3)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In birthdaycandles (line 2) In ScoringEngineTestPoint2 (line 3) In solutionTest (line 5)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In birthdaycandles (line 2) In ScoringEngineTestPoint3 (line 3) In solutionTest (line 7)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In birthdaycandles (line 2) In ScoringEngineTestPoint4 (line 3) In solutionTest (line 9)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In birthdaycandles (line 2) In ScoringEngineTestPoint5 (line 3) In solutionTest (line 11)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In birthdaycandles (line 2) In ScoringEngineTestPoint6 (line 3) In solutionTest (line 13)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In birthdaycandles (line 2) In ScoringEngineTestPoint7 (line 3) In solutionTest (line 15)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In birthdaycandles (line 2) In ScoringEngineTestPoint8 (line 3) In solutionTest (line 17)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In birthdaycandles (line 2) In ScoringEngineTestPoint9 (line 3) In solutionTest (line 19)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In birthdaycandles (line 2) In ScoringEngineTestPoint10 (line 3) In solutionTest (line 21)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In birthdaycandles (line 2) In ScoringEngineTestPoint11 (line 3) In solutionTest (line 23)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In birthdaycandles (line 2) In ScoringEngineTestPoint12 (line 3) In solutionTest (line 25)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In birthdaycandles (line 2) In ScoringEngineTestPoint13 (line 3) In solutionTest (line 27)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In birthdaycandles (line 2) In ScoringEngineTestPoint14 (line 3) In solutionTest (line 29)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In birthdaycandles (line 2) In ScoringEngineTestPoint15 (line 3) In solutionTest (line 31)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In birthdaycandles (line 2) In ScoringEngineTestPoint16 (line 3) In solutionTest (line 33)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In birthdaycandles (line 2) In ScoringEngineTestPoint17 (line 3) In solutionTest (line 35)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In birthdaycandles (line 2) In ScoringEngineTestPoint18 (line 3) In solutionTest (line 37)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In birthdaycandles (line 2) In ScoringEngineTestPoint19 (line 3) In solutionTest (line 39)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In birthdaycandles (line 2) In ScoringEngineTestPoint20 (line 3) In solutionTest (line 41)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In birthdaycandles (line 2) In ScoringEngineTestPoint21 (line 3) In solutionTest (line 43)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In birthdaycandles (line 2) In ScoringEngineTestPoint22 (line 3) In solutionTest (line 45)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In birthdaycandles (line 2) In ScoringEngineTestPoint23 (line 3) In solutionTest (line 47)]

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)

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In birthdaycandles (line 2) In ScoringEngineTestPoint24 (line 3) In solutionTest (line 49)]

### Community Treasure Hunt

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

Start Hunting!