Cody

Problem 42821. Polygon division

Solution 913970

Submitted on 23 Jun 2016 by Jean-Marie Sainthillier
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
filetext = fileread('polydiv.m'); assert(isempty(strfind(filetext,'str')))

2   Pass
n = 3; w_correct = 1; assert(isequal(polydiv(n),w_correct))

ans = Columns 1 through 8 1 1 1 2 5 14 42 132 Columns 9 through 16 429 1430 4862 16796 58786 208012 742900 2674440 Columns 17 through 19 9694845 35357670 129644790

3   Pass
n = 4; w_correct = 2; assert(isequal(polydiv(n),w_correct))

ans = Columns 1 through 8 1 1 1 2 5 14 42 132 Columns 9 through 16 429 1430 4862 16796 58786 208012 742900 2674440 Columns 17 through 19 9694845 35357670 129644790

4   Pass
n = 5; w_correct = 5; assert(isequal(polydiv(n),w_correct))

ans = Columns 1 through 8 1 1 1 2 5 14 42 132 Columns 9 through 16 429 1430 4862 16796 58786 208012 742900 2674440 Columns 17 through 19 9694845 35357670 129644790

5   Pass
n = 8; w_correct = 132; assert(isequal(polydiv(n),w_correct))

ans = Columns 1 through 8 1 1 1 2 5 14 42 132 Columns 9 through 16 429 1430 4862 16796 58786 208012 742900 2674440 Columns 17 through 19 9694845 35357670 129644790

6   Pass
n = 11; w_correct = 4862; assert(isequal(polydiv(n),w_correct))

ans = Columns 1 through 8 1 1 1 2 5 14 42 132 Columns 9 through 16 429 1430 4862 16796 58786 208012 742900 2674440 Columns 17 through 19 9694845 35357670 129644790

7   Pass
n = 15; w_correct = 742900; assert(isequal(polydiv(n),w_correct))

ans = Columns 1 through 8 1 1 1 2 5 14 42 132 Columns 9 through 16 429 1430 4862 16796 58786 208012 742900 2674440 Columns 17 through 19 9694845 35357670 129644790

Suggested Problems

More from this Author34

Community Treasure Hunt

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

Start Hunting!