Cody

Problem 44387. Birthday cake

Solution 1299305

Submitted on 18 Oct 2017
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.71; assert(isequal(birthdaycandles(len,wid),d_correct))

d1 = 0.5000 d2 = 0.7071 d = 0.7071 d = 0.7100

2   Pass
len = 2; wid = 3; d_correct = 1.80; assert(isequal(birthdaycandles(len,wid),d_correct))

d1 = 1.5000 d2 = 1.8028 d = 1.8028 d = 1.8000

3   Pass
len = 3; wid = 8; d_correct = 3.61; assert(isequal(birthdaycandles(len,wid),d_correct))

d1 = 3.6056 d2 = 3 d = 3.6056 d = 3.6100

4   Pass
len = 4; wid = 3; d_correct = 2.50; assert(isequal(birthdaycandles(len,wid),d_correct))

d1 = 2 d2 = 2.5000 d = 2.5000 d = 2.5000

5   Pass
len = 5; wid = 4; d_correct = 3.20; assert(isequal(birthdaycandles(len,wid),d_correct))

d1 = 2.5000 d2 = 3.2016 d = 3.2016 d = 3.2000

6   Pass
len = 5; wid = 6; d_correct = 3.91; assert(isequal(birthdaycandles(len,wid),d_correct))

d1 = 3 d2 = 3.9051 d = 3.9051 d = 3.9100

7   Fail
len = 5; wid = 11; d_correct = 5.52; assert(isequal(birthdaycandles(len,wid),d_correct))

d1 = 5.5000 d2 = 5 d = 5.5000 d = 5.5000

Assertion failed.

8   Pass
len = 7; wid = 6; d_correct = 4.61; assert(isequal(birthdaycandles(len,wid),d_correct))

d1 = 3.5000 d2 = 4.6098 d = 4.6098 d = 4.6100

9   Pass
len = 8; wid = 7; d_correct = 5.32; assert(isequal(birthdaycandles(len,wid),d_correct))

d1 = 4 d2 = 5.3151 d = 5.3151 d = 5.3200

10   Pass
len = 8; wid = 9; d_correct = 6.02; assert(isequal(birthdaycandles(len,wid),d_correct))

d1 = 4.5000 d2 = 6.0208 d = 6.0208 d = 6.0200

11   Pass
len = 10; wid = 9; d_correct = 6.73; assert(isequal(birthdaycandles(len,wid),d_correct))

d1 = 5 d2 = 6.7268 d = 6.7268 d = 6.7300

12   Pass
len = 11; wid = 10; d_correct = 7.43; assert(isequal(birthdaycandles(len,wid),d_correct))

d1 = 5.5000 d2 = 7.4330 d = 7.4330 d = 7.4300

13   Fail
len = 12; wid = 23; d_correct = 12.20; assert(isequal(birthdaycandles(len,wid),d_correct))

d1 = 11.5000 d2 = 12 d = 12 d = 12

Assertion failed.

14   Fail
len = 15; wid = 32; d_correct = 16.16; assert(isequal(birthdaycandles(len,wid),d_correct))

d1 = 16 d2 = 15 d = 16 d = 16

Assertion failed.

15   Pass
len = 16; wid = 32; d_correct = 16.56; assert(isequal(birthdaycandles(len,wid),d_correct))

d1 = 16 d2 = 16 d = 16 d = 16

16   Fail
len = 17; wid = 32; d_correct = 17.19; assert(isequal(birthdaycandles(len,wid),d_correct))

d1 = 16 d2 = 17 d = 17 d = 17

Assertion failed.

17   Pass
len = 64; wid = 1; d_correct = 16.03; assert(isequal(birthdaycandles(len,wid),d_correct))

d1 = 16.0312 d2 = 1 d = 16.0312 d = 16.0300

18   Pass
len = 36; wid = 36; d_correct = 25.46; assert(isequal(birthdaycandles(len,wid),d_correct))

d1 = 18 d2 = 25.4558 d = 25.4558 d = 25.4600

19   Pass
len = 48; wid = 24; d_correct = 24.85; assert(isequal(birthdaycandles(len,wid),d_correct))

d1 = 24 d2 = 24 d = 24 d = 24

20   Fail
len = 26; wid = 48; d_correct = 26.17; assert(isequal(birthdaycandles(len,wid),d_correct))

d1 = 24 d2 = 26 d = 26 d = 26

Assertion failed.

21   Pass
len = 100.25; wid = 100.25; d_correct = 70.89; assert(isequal(birthdaycandles(len,wid),d_correct))

d1 = 50.1250 d2 = 70.8875 d = 70.8875 d = 70.8900

22   Fail
len = 500; wid = 250; d_correct = 258.83; assert(isequal(birthdaycandles(len,wid),d_correct))

d1 = 250 d2 = 250 d = 250 d = 250

Assertion failed.

23   Fail
len = 500; wid = 1000; d_correct = 517.65; assert(isequal(birthdaycandles(len,wid),d_correct))

d1 = 500 d2 = 500 d = 500 d = 500

Assertion failed.

Community Treasure Hunt

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

Start Hunting!