Cody

Solution 858961

Submitted on 30 Mar 2016 by Zikobrelli
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
R = sqrt(2); n = 4; [p,a,r] = BoundedPolygon(R,n) p_correct = 8; a_correct = 4; r_correct = 1; assert(abs(p_correct-p)<0.0001 && abs(a_correct-a)<0.0001 && abs(r_correct-r)<0.0001);

c = 2 p = 8 r = 1 a = 4 p = 8 a = 4 r = 1

2   Pass
R = sqrt(3); n = 6; [p,a,r] = BoundedPolygon(R,n) p_correct = 10.3923; a_correct = 7.7942; r_correct = 1.5; assert(abs(p_correct-p)<0.0001 && abs(a_correct-a)<0.0001 && abs(r_correct-r)<0.0001);

c = 1.7321 p = 10.3923 r = 1.5000 a = 7.7942 p = 10.3923 a = 7.7942 r = 1.5000

3   Pass
R = 2; n = 12; [p,a,r] = BoundedPolygon(R,n) p_correct = 12.4233; a_correct = 12; r_correct = 1.9319; assert(abs(p_correct-p)<0.0001 && abs(a_correct-a)<0.0001 && abs(r_correct-r)<0.0001);

c = 1.0353 p = 12.4233 r = 1.9319 a = 12 p = 12.4233 a = 12 r = 1.9319

4   Pass
R = 3; n = 3; [p,a,r] = BoundedPolygon(R,n) p_correct = 15.5885; a_correct = 11.6913; r_correct = 1.5; assert(abs(p_correct-p)<0.0001 && abs(a_correct-a)<0.0001 && abs(r_correct-r)<0.0001);

c = 5.1962 p = 15.5885 r = 1.5000 a = 11.6913 p = 15.5885 a = 11.6913 r = 1.5000

5   Pass
R = 9; n = 56; [p,a,r] = BoundedPolygon(R,n) p_correct = 56.519; a_correct = 253.9354; r_correct = 8.9858; assert(abs(p_correct-p)<0.0001 && abs(a_correct-a)<0.0001 && abs(r_correct-r)<0.0001);

c = 1.0093 p = 56.5190 r = 8.9858 a = 253.9354 p = 56.5190 a = 253.9354 r = 8.9858

6   Pass
R = 2; n = 99; [p,a,r] = BoundedPolygon(R,n) p_correct = 12.5643; a_correct = 12.5579; r_correct = 1.999; assert(abs(p_correct-p)<0.0001 && abs(a_correct-a)<0.0001 && abs(r_correct-r)<0.0001);

c = 0.1269 p = 12.5643 r = 1.9990 a = 12.5579 p = 12.5643 a = 12.5579 r = 1.9990